Skip to content

Commit

Permalink
Add better tests
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesyringa committed Jul 29, 2024
1 parent 63cb04d commit 3063d69
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2497,3 +2497,22 @@ fn hash_positive_and_negative_zero() {
assert_eq!(rand.hash_one(k1), rand.hash_one(k2));
}
}

#[test]
fn test_control_character_search() {
// Different space circumstances
for n in 0..16 {
for m in 0..16 {
test_parse_err::<String>(&[(
&format!("\"{}\n{}\"", ".".repeat(n), ".".repeat(m)),
"control character (\\u0000-\\u001F) found while parsing a string at line 2 column 0",
)]);
}
}

// Multiple occurrences
test_parse_err::<String>(&[(
&"\"\t\n\r\"",
"control character (\\u0000-\\u001F) found while parsing a string at line 1 column 2",
)]);
}

0 comments on commit 3063d69

Please sign in to comment.