Skip to content

Commit

Permalink
Add regression test for problems with #565/#566
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbb committed Mar 10, 2023
1 parent e7f805b commit a97a16c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions serde_with/tests/serde_as/map_tuple_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,36 @@ fn test_tuple_array_as_map() {
}"#]],
);
}

// Test that the `Seq` conversion works when the inner type is explicity specified.
#[test]
fn test_map_as_tuple_with_nested_complex_type() {
#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct S0(#[serde_as(as = "Seq<(_, Vec<_>)>")] BTreeMap<usize, Vec<usize>>);

let value = S0(BTreeMap::from([
(1, Vec::from([1, 2])),
(2, Vec::from([3, 4])),
]));
is_equal(
value,
expect![[r#"
[
[
1,
[
1,
2
]
],
[
2,
[
3,
4
]
]
]"#]],
);
}

0 comments on commit a97a16c

Please sign in to comment.