Skip to content

Commit d26fb2c

Browse files
committed
Add empty-vec de/ser test
This patch adds the (failing) test from #114 to validate that this issue still exists on the latest version of the crate. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 parent e8dccf2 commit d26fb2c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/empty.rs

+19
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,22 @@ fn empty_deserializes() {
2121
assert_eq!(s.foo, 0);
2222
assert_eq!(s.bar, 0);
2323
}
24+
25+
#[test]
26+
fn test_empty_seq() {
27+
#[derive(Debug, Serialize, Deserialize, PartialEq)]
28+
struct Test {
29+
int: u32,
30+
seq: Vec<String>,
31+
}
32+
33+
let test = Test {
34+
int: 1,
35+
seq: vec![],
36+
};
37+
let config = Config::try_from(&test).unwrap();
38+
39+
let actual: Test = config.try_into().unwrap();
40+
assert_eq!(test, actual);
41+
}
42+

0 commit comments

Comments
 (0)