diff options
Diffstat (limited to 'vendor/regex-automata-0.2.0/tests/regression.rs')
-rw-r--r-- | vendor/regex-automata-0.2.0/tests/regression.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/regex-automata-0.2.0/tests/regression.rs b/vendor/regex-automata-0.2.0/tests/regression.rs new file mode 100644 index 000000000..e5355fed7 --- /dev/null +++ b/vendor/regex-automata-0.2.0/tests/regression.rs @@ -0,0 +1,44 @@ +use regex_automata::{ + dfa::{dense, Automaton}, + MatchError, +}; + +// A regression test for checking that minimization correctly translates +// whether a state is a match state or not. Previously, it was possible for +// minimization to mark a non-matching state as matching. +#[test] +fn minimize_sets_correct_match_states() { + let pattern = + // This is a subset of the grapheme matching regex. I couldn't seem + // to get a repro any smaller than this unfortunately. + r"(?x) + (?: + \p{gcb=Prepend}* + (?: + (?: + (?: + \p{gcb=L}* + (?:\p{gcb=V}+|\p{gcb=LV}\p{gcb=V}*|\p{gcb=LVT}) + \p{gcb=T}* + ) + | + \p{gcb=L}+ + | + \p{gcb=T}+ + ) + | + \p{Extended_Pictographic} + (?:\p{gcb=Extend}*\p{gcb=ZWJ}\p{Extended_Pictographic})* + | + [^\p{gcb=Control}\p{gcb=CR}\p{gcb=LF}] + ) + [\p{gcb=Extend}\p{gcb=ZWJ}\p{gcb=SpacingMark}]* + ) + "; + + let dfa = dense::Builder::new() + .configure(dense::Config::new().anchored(true).minimize(true)) + .build(pattern) + .unwrap(); + assert_eq!(Ok(None), dfa.find_leftmost_fwd(b"\xE2")); +} |