From 3063d69fd53f075d06318c0b19a7ddd700fe57a6 Mon Sep 17 00:00:00 2001 From: Alisa Sireneva Date: Mon, 29 Jul 2024 13:23:01 +0300 Subject: [PATCH] Add better tests --- tests/test.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test.rs b/tests/test.rs index 71087162b..6923e6e38 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -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::(&[( + &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::(&[( + &"\"\t\n\r\"", + "control character (\\u0000-\\u001F) found while parsing a string at line 1 column 2", + )]); +}