Skip to content

Commit 3063d69

Browse files
committed
Add better tests
1 parent 63cb04d commit 3063d69

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,3 +2497,22 @@ fn hash_positive_and_negative_zero() {
24972497
assert_eq!(rand.hash_one(k1), rand.hash_one(k2));
24982498
}
24992499
}
2500+
2501+
#[test]
2502+
fn test_control_character_search() {
2503+
// Different space circumstances
2504+
for n in 0..16 {
2505+
for m in 0..16 {
2506+
test_parse_err::<String>(&[(
2507+
&format!("\"{}\n{}\"", ".".repeat(n), ".".repeat(m)),
2508+
"control character (\\u0000-\\u001F) found while parsing a string at line 2 column 0",
2509+
)]);
2510+
}
2511+
}
2512+
2513+
// Multiple occurrences
2514+
test_parse_err::<String>(&[(
2515+
&"\"\t\n\r\"",
2516+
"control character (\\u0000-\\u001F) found while parsing a string at line 1 column 2",
2517+
)]);
2518+
}

0 commit comments

Comments
 (0)