Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
donno2048 authored Apr 17, 2024
1 parent 9d27cbf commit e6b386b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/tools/tidy/src/style/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use super::*;

#[test]
fn test_generate_problematic_strings() {
let problematic_regex = RegexSet::new(
generate_problematic_strings(
ROOT_PROBLEMATIC_CONSTS,
&[('A', '4'), ('B', '8'), ('E', '3'), ('F', '0')].iter().cloned().collect(),
)
.as_slice(),
)
.unwrap();
assert!(problematic_regex.is_match("524421")); // check for only "decimal" hex digits (converted to integer intentionally)

Check failure on line 13 in src/tools/tidy/src/style/tests.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

Don't use magic numbers that spell things (consider 0x12345678)
assert!(problematic_regex.is_match("721077")); // check for char replacements (converted to integer intentionally)

Check failure on line 14 in src/tools/tidy/src/style/tests.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

Don't use magic numbers that spell things (consider 0x12345678)
assert!(problematic_regex.is_match("8FF85")); // check for hex display but use "futile" F intentionally

Check failure on line 15 in src/tools/tidy/src/style/tests.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

trailing whitespace
assert!(!problematic_regex.is_match("1193046")); // check for non-matching value
}

0 comments on commit e6b386b

Please sign in to comment.