Add tests for regex_helper

This commit is contained in:
sharkdp 2020-04-03 11:50:43 +02:00 committed by David Peter
parent 809fd8fb78
commit 9ef9bf7b80

View file

@ -33,3 +33,20 @@ fn hir_has_uppercase_char(hir: &Hir) -> bool {
_ => false,
}
}
#[test]
fn pattern_has_uppercase_char_simple() {
assert!(pattern_has_uppercase_char("A"));
assert!(pattern_has_uppercase_char("foo.EXE"));
assert!(!pattern_has_uppercase_char("a"));
assert!(!pattern_has_uppercase_char("foo.exe123"));
}
#[test]
fn pattern_has_uppercase_char_advanced() {
assert!(pattern_has_uppercase_char("foo.[a-zA-Z]"));
assert!(!pattern_has_uppercase_char(r"\Acargo"));
assert!(!pattern_has_uppercase_char(r"carg\x6F"));
}