regex: add unit tests for non-matching anchor bytes

This is in addition to the integration level test added in
581a35e568c3acd32461d276a4cfe746524e17cd.
This commit is contained in:
Andrew Gallant 2021-05-29 20:09:58 -04:00
parent a77b914e7a
commit 35b52d33b9

View File

@ -128,4 +128,12 @@ mod tests {
assert_eq!(sparse(&extract(r"\xFF")), sparse_except(&[0xC3, 0xBF])); assert_eq!(sparse(&extract(r"\xFF")), sparse_except(&[0xC3, 0xBF]));
assert_eq!(sparse(&extract(r"(?-u)\xFF")), sparse_except(&[0xFF])); 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']));
}
} }