>().join(" ")
}
#[test]
fn loops1(){
let my_int = 3;
let my_str = "asdf";
let my_vec = vec![true, false, true, true];
assert_eq!(bs(xhtml!(
{{ for v in my_vec.iter() {{
{{my_int}}, {{my_str}}, {{v}}
}} }}
)),
" 3, asdf, true 3, asdf, false 3, asdf, true 3, asdf, true
".to_string());
}
#[test]
fn loops2(){
let mut my_counter = 3;
assert_eq!(bs(xhtml!(
{{ while my_counter > 0 {{
{{my_counter}}
{{ my_counter -= 1; }}
}} }}
)),
" 3 2 1
".to_string());
}
#[test]
fn loops3(){
let mut my_some = Some(23);
assert_eq!(bs(xhtml!(
{{ while let Some(my_num) = my_some {{
{{my_num}}
{{ my_some = None; }}
}} }}
)),
" 23
".to_string());
}
#[allow(unreachable_code)]
#[test]
fn loops4(){
assert_eq!(bs(xhtml!(
{{ loop {{
inside loop
{{ break; }}
}} }}
)),
"");
}