From 2f45d586b5b2783699090f7a1700a7d1f072d3d8 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 25 Aug 2019 20:02:06 +0200 Subject: [PATCH] xhtml: Add a tree generation example. --- src/xhtml.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/xhtml.rs b/src/xhtml.rs index c4fc0c0..43ea9e6 100644 --- a/src/xhtml.rs +++ b/src/xhtml.rs @@ -469,4 +469,19 @@ mod tests { let html = xhtml_im.to_html(); assert_eq!(html, "

Hello world!

"); } + + #[test] + fn generate_tree() { + let world = "world".to_string(); + + Body { style: vec![], xml_lang: Some("en".to_string()), children: vec![ + Child::Tag(Tag::P { style: vec![], children: vec![ + Child::Text("Hello ".to_string()), + Child::Tag(Tag::Strong { children: vec![ + Child::Text(world), + ] }), + Child::Text("!".to_string()), + ] }), + ] }; + } }