Fix unnamed enum variants serialized ignoring namespace prefix

This commit is contained in:
Dmitry Samoylov
2020-01-20 17:55:51 +07:00
parent f8ffe8c88e
commit f1c7818656
2 changed files with 16 additions and 12 deletions

View File

@@ -47,12 +47,19 @@ fn ser_enum_namespace() {
pub enum XmlStruct {
#[yaserde(prefix = "ns")]
Item,
#[yaserde(prefix = "ns")]
ItemWithField(String),
}
let model = XmlStruct::Item;
let content = "<?xml version=\"1.0\" encoding=\"utf-8\"?><ns:root xmlns:ns=\"http://www.sample.com/ns/domain\">ns:Item</ns:root>";
convert_and_validate!(model, content);
let model = XmlStruct::ItemWithField("Value".to_string());
let content = "<?xml version=\"1.0\" encoding=\"utf-8\"?><ns:root xmlns:ns=\"http://www.sample.com/ns/domain\"><ns:ItemWithField>Value</ns:ItemWithField></ns:root>";
convert_and_validate!(model, content);
}
#[test]