use rdxl::{xhtml,xtype,xrender,xtextrender};
fn bs(s: String) -> String {
s.split_whitespace().collect::>().join(" ")
}
xtype!();
xtype!(
);
xtype!();
xrender!(MyList,
- {{ self.my_string }}
- {{ self.my_int }}
{{ for i in self.children.iter() {{
{{ if let MyListChildren::MyItem(my_item) = i {{
- MyItem: {{ my_item.my_bool }}
}} else if let MyListChildren::MyOtherItem(my_other_item) = i {{
- MyOtherItem: {{ my_other_item.my_char }}
}} }}
}} }}
);
xrender!(MyItem, my_bool: {{ self.my_bool }});
xrender!(MyOtherItem, my_char: {{ self.my_char }});
xtextrender!(MyTextType, a: 1);
#[test]
fn simple_class1() {
assert_eq!(
bs(xhtml!()),
"my_bool: true".to_string()
);
}
#[test]
fn simple_class2() {
assert_eq!(
bs(xhtml!()),
"my_char: c".to_string()
);
}
#[test]
fn text_class1() {
assert_eq!(
xhtml!(),
"a:1".to_string()
);
}
#[test]
fn complex_class1(){
assert_eq!(
bs(xhtml!(
)),
" - abcdefg
- 33
- MyItem: true
- MyItem: false
- MyOtherItem: a
".to_string()
);
}