diff options
author | Andrew Gallant <jamslam@gmail.com> | 2021-05-29 20:09:58 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2021-05-31 21:51:18 -0400 |
commit | 35b52d33b97edeff60b77f8f4501ea2ac1af3d51 (patch) | |
tree | b82a51429ed7de0759ac8b43b7623cd32260980f | |
parent | a77b914e7ac9fe83602d7e43f8c2187cb5b03dc1 (diff) |
regex: add unit tests for non-matching anchor bytes
This is in addition to the integration level test added in
581a35e568c3acd32461d276a4cfe746524e17cd.
-rw-r--r-- | crates/regex/src/non_matching.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/regex/src/non_matching.rs b/crates/regex/src/non_matching.rs index e2e0755b..7f68e84a 100644 --- a/crates/regex/src/non_matching.rs +++ b/crates/regex/src/non_matching.rs @@ -128,4 +128,12 @@ mod tests { assert_eq!(sparse(&extract(r"\xFF")), sparse_except(&[0xC3, 0xBF])); assert_eq!(sparse(&extract(r"(?-u)\xFF")), sparse_except(&[0xFF])); } + + #[test] + fn anchor() { + assert_eq!(sparse(&extract(r"^")), sparse_except(&[b'\n'])); + assert_eq!(sparse(&extract(r"$")), sparse_except(&[b'\n'])); + assert_eq!(sparse(&extract(r"\A")), sparse_except(&[b'\n'])); + assert_eq!(sparse(&extract(r"\z")), sparse_except(&[b'\n'])); + } } |