Fix it! Accursed whitespace!

This commit is contained in:
Timothy Warren 2020-02-10 15:34:10 -05:00
parent 5ab5dd2e1b
commit a2ecaef5ee

View File

@ -154,6 +154,8 @@ impl JSON {
result.insert(key, value); result.insert(key, value);
initial = false; initial = false;
self.skip_whitespace();
} }
// Move to the next character: '}' // Move to the next character: '}'
@ -509,6 +511,10 @@ mod tests {
#[test] #[test]
fn can_parse_arbitrary_json() { 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( let result = JSON::parse(
r#"[{ r#"[{
"a": 9.38083151965, "a": 9.38083151965,
@ -523,8 +529,7 @@ mod tests {
} }
}, },
"i": ["\"", "\\", "/", "\b", "\f", "\n", "\r", "\t", "\u0001", "\uface"] "i": ["\"", "\\", "/", "\b", "\f", "\n", "\r", "\t", "\u0001", "\uface"]
}]"#, }]"#);
);
assert!(result.is_ok(), format!("{:#?}", result)); assert!(result.is_ok(), format!("{:#?}", result));
} }
} }