Skip to content

Commit

Permalink
add unit tests of anchor + whitespace
Browse files Browse the repository at this point in the history
resolves #122
  • Loading branch information
yshavit authored Aug 11, 2024
1 parent b6287f6 commit 854ecbe
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,19 @@ mod test {
assert_eq!(false, m.matches("hello post"));
}

#[test]
fn anchor_whitespace() {
parse_and_check("^foo", re("(?i)^foo"), "");
parse_and_check("^ foo", re("(?i)^foo"), "");
parse_and_check("^ 'foo'", re("^foo"), "");

parse_and_check("bar$", re("(?i)bar$"), "");
parse_and_check("bar $", re("(?i)bar$"), "");
parse_and_check("'bar' $", re("bar$"), "");

parse_and_check(" ^ foobar $ ", re("(?i)^foobar$"), " ");
}

#[test]
fn bareword_regex_char() {
let m = parse_and_check("hello.world", re_insensitive("hello\\.world"), "");
Expand Down

0 comments on commit 854ecbe

Please sign in to comment.