Skip to content

Commit

Permalink
Test integer key
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 18, 2019
1 parent 82ce356 commit 81fa4e8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,28 @@ fn test_readme() {
};
assert_eq!(p, expected);
}

#[test]
fn test_int_key() {
#[derive(Debug, Deserialize)]
struct Test {
a: Map<usize, V>,
}

#[derive(Debug, Deserialize)]
struct V {
used: (),
}

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

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

0 comments on commit 81fa4e8

Please sign in to comment.