Skip to content

Commit

Permalink
[#36] Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Orchaldir committed Sep 11, 2023
1 parent 9991c5f commit 6721fdf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions macro_ui/tests/parse_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,30 @@ fn test_complex_enum_with_fields() {
)
}

#[test]
fn test_complex_struct() {
let parser = MockParser::new(HashMap::from([
("test.a", "2"),
("test.b", "3"),
("test.inner.c", "4"),
("test.simple", "B"),
("test.complex.type", "E"),
("test.complex.d", "6"),
("test.complex.e", "7"),
]));

assert_eq!(
ComplexStruct::parse(&parser, "test", ""),
ComplexStruct {
a: 2,
b: 3,
inner: SimpleStruct { c: 4 },
simple: SimpleEnum::B,
complex: ComplexEnum::E { d: 6, e: 7 },
}
);
}

fn assert_simple_enum(text: &str, value: SimpleEnum) {
let parser = MockParser::new(HashMap::from([("test", text)]));

Expand Down

0 comments on commit 6721fdf

Please sign in to comment.