From a2ecaef5eec737a1aabb124bd6de4873f29cf498 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 10 Feb 2020 15:34:10 -0500 Subject: [PATCH] Fix it! Accursed whitespace! --- src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0a2edcf..0ff2169 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -154,6 +154,8 @@ impl JSON { result.insert(key, value); initial = false; + + self.skip_whitespace(); } // Move to the next character: '}' @@ -509,6 +511,10 @@ mod tests { #[test] fn can_parse_arbitrary_json() { + let result = JSON::parse(r#"[{ "a": 9.38083151965, "b": 4e3 }]"#); + assert!(result.is_ok(), format!("Failed on just number values: {:#?}", result)); + + let result = JSON::parse( r#"[{ "a": 9.38083151965, @@ -523,8 +529,7 @@ mod tests { } }, "i": ["\"", "\\", "/", "\b", "\f", "\n", "\r", "\t", "\u0001", "\uface"] -}]"#, - ); +}]"#); assert!(result.is_ok(), format!("{:#?}", result)); } }