use super::XMLBuilder; use super::XmlEvent; impl XMLBuilder { // Build Properties element // i.e. opened_el!(open_properties, "Properties", "xmlns", "xmlns:vt"); closed_el_with_child!(template, "Template"); closed_el_with_child!(total_time, "TotalTime"); closed_el_with_child!(application, "Application"); closed_el_with_child!(pages, "Pages"); closed_el_with_child!(words, "Words"); closed_el_with_child!(characters, "Characters"); closed_el_with_child!(characters_with_spaces, "CharactersWithSpaces"); closed_el_with_child!(paragraphs, "Paragraphs"); } #[cfg(test)] mod tests { use super::XMLBuilder; use std::str; #[test] fn test_properties() { let b = XMLBuilder::new(); let r = b .open_properties("http://example", "http://example2") .plain_text("child") .close() .build(); assert_eq!( str::from_utf8(&r).unwrap(), r#"child"# ); } #[test] fn test_template() { let b = XMLBuilder::new(); let r = b.template("0").build(); assert_eq!(str::from_utf8(&r).unwrap(), r#""#); } #[test] fn test_application() { let b = XMLBuilder::new(); let r = b.application("Lawgue").build(); assert_eq!( str::from_utf8(&r).unwrap(), r#"Lawgue"# ); } }