summaryrefslogtreecommitdiffstats
path: root/third_party/rust/regex/tests/test_crates_regex.rs
blob: a68160472762cedde0bc33cdc243d199554bed4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * This test is a minimal version of <rofl_0> and <subdiff_0>
 *
 * Once this bug gets fixed, uncomment rofl_0 and subdiff_0
 * (in `tests/crates_regex.rs`).
#[test]
fn word_boundary_backtracking_default_mismatch() {
    use regex::internal::ExecBuilder;

    let backtrack_re = ExecBuilder::new(r"\b")
        .bounded_backtracking()
        .build()
        .map(|exec| exec.into_regex())
        .map_err(|err| format!("{}", err))
        .unwrap();

    let default_re = ExecBuilder::new(r"\b")
        .build()
        .map(|exec| exec.into_regex())
        .map_err(|err| format!("{}", err))
        .unwrap();

    let input = "䅅\\u{a0}";

    let fi1 = backtrack_re.find_iter(input);
    let fi2 = default_re.find_iter(input);
    for (m1, m2) in fi1.zip(fi2) {
        assert_eq!(m1, m2);
    }
}
*/

mod consistent;

mod crates_regex {

    macro_rules! consistent {
        ($test_name:ident, $regex_src:expr) => {
            #[test]
            fn $test_name() {
                use super::consistent::backends_are_consistent;

                if option_env!("RUST_REGEX_RANDOM_TEST").is_some() {
                    match backends_are_consistent($regex_src) {
                        Ok(_) => {}
                        Err(err) => panic!("{}", err),
                    }
                }
            }
        };
    }

    include!("crates_regex.rs");
}