Fix it! Accursed whitespace!

This commit is contained in:
Timothy Warren 2020-02-10 15:34:10 -05:00
parent 5ab5dd2e1b
commit a2ecaef5ee
1 changed files with 7 additions and 2 deletions

View File

@ -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));
}
}