Skip to content

Commit

Permalink
Add test for field aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Feb 22, 2024
1 parent ff11d81 commit 03a470d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,3 +873,15 @@ fn serde_default_fields() {
// Check that it parses successfully despite the missing field.
let _struct: Struct = from_value(obj).unwrap();
}

#[wasm_bindgen_test]
fn field_aliases() {
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Struct {
#[serde(alias = "b")]
a: i32,
c: i32,
}

test_via_round_trip_with_config(Struct { a: 42, c: 84 }, &SERIALIZER);
}

0 comments on commit 03a470d

Please sign in to comment.