Skip to content

Commit

Permalink
Test unit variant key
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 18, 2019
1 parent 9a5f273 commit d7f9411
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,24 @@ fn test_newtype_key() {
let ignored = &["k.unused"];
assert_ignored::<Test>(json, ignored);
}

#[test]
fn test_unit_variant_key() {
type Test = Map<Key, V>;

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Deserialize)]
enum Key {
First,
Second,
}

let json = r#"{
"First": {
"used": null,
"unused": null
}
}"#;

let ignored = &["First.unused"];
assert_ignored::<Test>(json, ignored);
}

0 comments on commit d7f9411

Please sign in to comment.