mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-29 00:17:55 +00:00
Allow Vecs, BTreeMaps, and HashMaps to be deserialized from a unit
Closes #36
This commit is contained in:
+9
-2
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user