| 1 |
// Tests that we can call the PikeVM with more slots |
| 2 |
// than is actually in the compiled regex. |
| 3 |
#[test] |
| 4 |
fn too_many_slots_normal_pattern() { |
| 5 |
use regex_automata::{ |
| 6 |
nfa::thompson::pikevm::PikeVM, util::primitives::NonMaxUsize, |
| 7 |
Anchored, Input, |
| 8 |
}; |
| 9 |
|
| 10 |
let expr = PikeVM::new(r"abc").unwrap(); |
| 11 |
let s = "abc"; |
| 12 |
let input = Input::new(s).span(0..s.len()).anchored(Anchored::Yes); |
| 13 |
|
| 14 |
let mut cache = expr.create_cache(); |
| 15 |
let mut slots: Vec<Option<NonMaxUsize>> = vec![None; 4]; |
| 16 |
let pid = expr.search_slots(&mut cache, &input, &mut slots); |
| 17 |
assert_eq!(pid, Some(regex_automata::PatternID::must(0))); |
| 18 |
assert_eq!(slots[0], Some(NonMaxUsize::new(0).unwrap())); |
| 19 |
assert_eq!(slots[1], Some(NonMaxUsize::new(3).unwrap())); |
| 20 |
} |