File: mod.rs

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,245,360 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (22 lines) | stat: -rw-r--r-- 902 bytes parent folder | download | duplicates (96)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use regex_automata::{Input, Match};

mod multi_pattern_v2;

#[test]
fn multi_pattern_v2() {
    use multi_pattern_v2::MULTI_PATTERN_V2 as RE;

    assert_eq!(Some(Match::must(0, 0..4)), RE.find("abcd"));
    assert_eq!(Some(Match::must(0, 2..6)), RE.find("@ abcd @"));
    assert_eq!(Some(Match::must(1, 0..6)), RE.find("@abcd@"));
    assert_eq!(Some(Match::must(0, 1..5)), RE.find("\nabcd\n"));
    assert_eq!(Some(Match::must(0, 1..5)), RE.find("\nabcd wxyz\n"));
    assert_eq!(Some(Match::must(1, 1..7)), RE.find("\n@abcd@\n"));
    assert_eq!(Some(Match::must(2, 0..6)), RE.find("@abcd@\r\n"));
    assert_eq!(Some(Match::must(1, 2..8)), RE.find("\r\n@abcd@"));
    assert_eq!(Some(Match::must(2, 2..8)), RE.find("\r\n@abcd@\r\n"));

    // Fails because we have heuristic support for Unicode word boundaries
    // enabled.
    assert!(RE.try_search(&Input::new(b"\xFF@abcd@\xFF")).is_err());
}