Allow Vecs, BTreeMaps, and HashMaps to be deserialized from a unit

Closes #36
This commit is contained in:
Erick Tryzelaar
2015-03-20 08:47:33 -07:00
parent d17846eff1
commit 09de237033
3 changed files with 58 additions and 2 deletions
+9 -2
View File
@@ -861,8 +861,8 @@ fn test_parse_object() {
#[test]
fn test_parse_struct() {
test_parse_err::<Outer>(vec![
("[]", Error::SyntaxError(ErrorCode::ExpectedSomeValue, 0, 0)),
("{}", Error::SyntaxError(ErrorCode::ExpectedSomeValue, 0, 0)),
("5", Error::SyntaxError(ErrorCode::ExpectedSomeValue, 0, 0)),
("\"hello\"", Error::SyntaxError(ErrorCode::ExpectedSomeValue, 0, 0)),
("{\"inner\": true}", Error::SyntaxError(ErrorCode::ExpectedSomeValue, 0, 0)),
]);
@@ -888,6 +888,13 @@ fn test_parse_struct() {
},
)
]);
assert_eq!(
from_str("{}"),
Ok(Outer {
inner: vec![],
})
);
}
#[test]