Sha256: ebcf2645290286aa7531eb2b7951385e5ed8167532437aeca2ad2049768fd796

Contents?: true

Size: 1.59 KB

Versions: 30

Compression:

Stored size: 1.59 KB

Contents

// 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]
#[cfg(not(miri))]
fn minimize_sets_correct_match_states() {
    use regex_automata::{
        dfa::{dense::DFA, Automaton, StartKind},
        Anchored, Input,
    };

    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 = DFA::builder()
        .configure(
            DFA::config().start_kind(StartKind::Anchored).minimize(true),
        )
        .build(pattern)
        .unwrap();
    let input = Input::new(b"\xE2").anchored(Anchored::Yes);
    assert_eq!(Ok(None), dfa.try_search_fwd(&input));
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/regex-automata-0.4.9/tests/dfa/regression.rs
wasmtime-28.0.0 ./ext/cargo-vendor/regex-automata-0.4.9/tests/dfa/regression.rs
wasmtime-27.0.0 ./ext/cargo-vendor/regex-automata-0.4.9/tests/dfa/regression.rs
wasmtime-26.0.0 ./ext/cargo-vendor/regex-automata-0.4.8/tests/dfa/regression.rs
wasmtime-25.0.2 ./ext/cargo-vendor/regex-automata-0.4.7/tests/dfa/regression.rs
wasmtime-25.0.1 ./ext/cargo-vendor/regex-automata-0.4.7/tests/dfa/regression.rs
wasmtime-25.0.0 ./ext/cargo-vendor/regex-automata-0.4.7/tests/dfa/regression.rs
wasmtime-24.0.0 ./ext/cargo-vendor/regex-automata-0.4.7/tests/dfa/regression.rs
wasmtime-23.0.2 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-22.0.0 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-21.0.1 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-20.0.2 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-20.0.0 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-18.0.3 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-17.0.1 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-17.0.0 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-16.0.0 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-15.0.1 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-15.0.0 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs
wasmtime-14.0.4 ./ext/cargo-vendor/regex-automata-0.4.3/tests/dfa/regression.rs