askama/testing/tests/operators.rs
Dirkjan Ochtman aa98f61fa7 Discard trailing newlines from templates by default
This matches Jinja's behavior, and seems sensible.
2017-03-03 16:44:54 +01:00

35 lines
626 B
Rust

extern crate askama;
#[macro_use]
extern crate askama_derive;
use askama::Template;
#[derive(Template)]
#[template(path = "compare.html")]
struct CompareTemplate {
a: usize,
b: usize,
c: usize,
}
#[test]
fn test_compare() {
let t = CompareTemplate { a: 1, b: 1, c: 2 };
assert_eq!(t.render(), "tf\ntf\ntf\ntf\ntf\ntf");
}
#[derive(Template)]
#[template(path = "operators.html")]
struct OperatorsTemplate {
a: usize,
b: usize,
c: usize,
}
#[test]
fn test_operators() {
let t = OperatorsTemplate { a: 1, b: 1, c: 2 };
assert_eq!(t.render(), "muldivmodaddrshlshbandbxorborandor");
}