mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
33 lines
653 B
Rust
33 lines
653 B
Rust
use rustical_xml::{XmlRootTag, XmlSerialize, XmlSerializeRoot};
|
|
|
|
#[test]
|
|
fn test_struct_value_tagged() {
|
|
#[derive(Debug, XmlRootTag, XmlSerialize, PartialEq)]
|
|
#[xml(root = "propfind")]
|
|
struct Document {
|
|
prop: Prop,
|
|
}
|
|
|
|
#[derive(Debug, XmlSerialize, PartialEq)]
|
|
enum Prop {
|
|
Test(String),
|
|
// Hello(usize),
|
|
// Unit,
|
|
}
|
|
|
|
let out = Document {
|
|
prop: Prop::Test("asd".to_owned()),
|
|
}
|
|
.serialize_to_string()
|
|
.unwrap();
|
|
assert_eq!(
|
|
out,
|
|
r#"<?xml version="1.0" encoding="utf-8"?>
|
|
<propfind>
|
|
<prop>
|
|
<test>asd</test>
|
|
</prop>
|
|
</propfind>"#
|
|
);
|
|
}
|