Skip to content

Commit e6b386b

Browse files
authored
add tests
1 parent 9d27cbf commit e6b386b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/tools/tidy/src/style/tests.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_generate_problematic_strings() {
5+
let problematic_regex = RegexSet::new(
6+
generate_problematic_strings(
7+
ROOT_PROBLEMATIC_CONSTS,
8+
&[('A', '4'), ('B', '8'), ('E', '3'), ('F', '0')].iter().cloned().collect(),
9+
)
10+
.as_slice(),
11+
)
12+
.unwrap();
13+
assert!(problematic_regex.is_match("524421")); // check for only "decimal" hex digits (converted to integer intentionally)
14+
assert!(problematic_regex.is_match("721077")); // check for char replacements (converted to integer intentionally)
15+
assert!(problematic_regex.is_match("8FF85")); // check for hex display but use "futile" F intentionally
16+
assert!(!problematic_regex.is_match("1193046")); // check for non-matching value
17+
}

0 commit comments

Comments
 (0)