Skip to content

Commit

Permalink
Add test for ron-rs#456 and fix bitflags glob import (ron-rs#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Aug 16, 2023
1 parent 887b15f commit 271c1cd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/115_minimal_flattening.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,30 @@ AllOptional({

assert_eq!(de, val);
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct AvailableCards {
pub left: u8,
pub right: u8,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
struct MapProperties {
#[serde(flatten)]
cards: AvailableCards,
}

#[test]
fn test_issue_456() {
let map_properties = MapProperties {
cards: AvailableCards {
..Default::default()
},
};
let ron = ron::to_string(&map_properties).unwrap();

let de: MapProperties = ron::from_str(&ron).unwrap();

assert_eq!(map_properties, de);
}

0 comments on commit 271c1cd

Please sign in to comment.