From 172275a5f6fd2395bca328f8d625709991b3145b Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Mon, 5 Dec 2022 00:46:53 -0800 Subject: [PATCH] add parse_string test --- tests/json_parser.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/json_parser.rs b/tests/json_parser.rs index 25b36e3..44cd69b 100644 --- a/tests/json_parser.rs +++ b/tests/json_parser.rs @@ -11,6 +11,16 @@ proptest! { fn doesnt_crash(s in "\\PC*") { let _output = json_object().parse(&s); } + + #[test] + fn parse_string(s in r#"[^"]+"#) { + let input = format!("\"{}\"", s); + let output = json_string().parse(&input).unwrap(); + match output { + (JsonValue::Str(output_s), "") if output_s == s => (), + _ => panic!(), + } + } } #[test]