use std::collections::HashMap;
use kitamura::render_template;
#[test]
fn control_flow_does_not_exist() {
let html = "
{#forrgfeqwv fruit of fruits#}- ${fruit.name}
- ${fruit.colour}
- ${fruit.weight}
{#endfor#}
";
let params = HashMap::new();
let rendered_html = render_template(html.to_string(), params);
assert!(rendered_html.is_err())
}
#[test]
fn control_flow_syntax_error_extra_brace() {
let html = "{{#for fruit of fruits#}- ${fruit.name}
- ${fruit.colour}
- ${fruit.weight}
{#endfor#}
";
let params = HashMap::new();
let rendered_html = render_template(html.to_string(), params);
assert!(rendered_html.is_err())
}
#[test]
fn control_flow_syntax_error_extra_pound() {
let html = "{##for fruit of fruits#}- ${fruit.name}
- ${fruit.colour}
- ${fruit.weight}
{#endfor#}
";
let params = HashMap::new();
let rendered_html = render_template(html.to_string(), params);
assert!(rendered_html.is_err())
}
#[test]
fn control_flow_missing_end() {
let html = "{#for fruit of fruits#}";
let params = HashMap::new();
let rendered_html = render_template(html.to_string(), params);
assert!(rendered_html.is_err())
}
#[test]
fn nested_control_flow_missing_end() {
let html = "{#for fruit of fruits#}{#for thing of something#}{#endfor#}";
let params = HashMap::new();
let rendered_html = render_template(html.to_string(), params);
assert!(rendered_html.is_err())
}