xml: Implement XmlDocument for tagged enums and fix small bug

This commit is contained in:
Lennart
2024-12-23 13:02:59 +01:00
parent 6721e876fa
commit 98ed1a3fc5
5 changed files with 65 additions and 1 deletions

View File

@@ -96,3 +96,20 @@ fn test_tagged_enum_complex() {
.unwrap();
dbg!(asd);
}
#[test]
fn test_enum_document() {
#[derive(Debug, XmlDeserialize, XmlDocument, PartialEq)]
enum Document {
Hello,
Goodbye,
}
assert_eq!(
Document::parse_str(r"<hello></hello>").unwrap(),
Document::Hello
);
assert_eq!(
Document::parse_str(r"<goodbye/>").unwrap(),
Document::Goodbye
);
}