Skip to content

Commit

Permalink
Add test for boolean keys in map
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 15, 2023
1 parent 8652bf2 commit 58dd8d9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2018,6 +2018,14 @@ fn test_deny_non_finite_f64_key() {
assert!(serde_json::to_value(map).is_err());
}

#[test]
fn test_boolean_key() {
let map = treemap!(false => 0, true => 1);
let j = r#"{"false":0,"true":1}"#;
test_encode_ok(&[(&map, j)]);
test_parse_ok(vec![(j, map)]);
}

#[test]
fn test_borrowed_key() {
let map: BTreeMap<&str, ()> = from_str("{\"borrowed\":null}").unwrap();
Expand Down

0 comments on commit 58dd8d9

Please sign in to comment.