askama/testing/tests/coerce.rs
Christian Vallentin a199defeca
Improved if statement generation to avoid issues with implicit borrows (#392)
* Changed to automatically coerce to bool

* Added new test case

* Updated test case to include else if
2020-12-01 17:01:05 +01:00

15 lines
278 B
Rust

use askama::Template;
#[derive(Template)]
#[template(path = "if-coerce.html")]
struct IfCoerceTemplate {
t: bool,
f: bool,
}
#[test]
fn test_coerce() {
let t = IfCoerceTemplate { t: true, f: false };
assert_eq!(t.render().unwrap(), "ftftfttftelseifelseif");
}