Skip to content

Commit

Permalink
Merge #573
Browse files Browse the repository at this point in the history
573: Add regression test for problems with #565/#566 r=jonasbb a=jonasbb

#572

#565 (comment)

bors r+

Co-authored-by: Jonas Bushart <jonas@bushart.org>
  • Loading branch information
bors[bot] and jonasbb authored Mar 10, 2023
2 parents e7f805b + a97a16c commit d62e486
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 d62e486

Please sign in to comment.