mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 09:22:26 +00:00
xml: Implement XmlDeserialize for values
This commit is contained in:
@@ -229,3 +229,27 @@ fn test_struct_unparsed() {
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_xml_values() {
|
||||
#[derive(XmlDeserialize, XmlRootTag, PartialEq, Debug)]
|
||||
#[xml(root = b"document", ns_strict)]
|
||||
struct Document {
|
||||
href: String,
|
||||
}
|
||||
|
||||
let doc = Document::parse_str(
|
||||
r#"
|
||||
<document>
|
||||
<href>/asd</href>
|
||||
</document>
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
doc,
|
||||
Document {
|
||||
href: "/asd".to_owned()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user