Skip to content

Commit

Permalink
Add empty-vec de/ser test
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
matthiasbeyer committed Jul 10, 2021
1 parent 74a0a80 commit 0f9fd1b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,22 @@ fn empty_deserializes() {
assert_eq!(s.foo, 0);
assert_eq!(s.bar, 0);
}

#[test]
fn test_empty_seq() {
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Test {
int: u32,
seq: Vec<String>,
}

let test = Test {
int: 1,
seq: vec![],
};
let config = Config::try_from(&test).unwrap();

let actual: Test = config.try_into().unwrap();
assert_eq!(test, actual);
}

0 comments on commit 0f9fd1b

Please sign in to comment.