From 4568c40ae4bd51258290a4b0da169b3d5bce9ee7 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 4 Feb 2017 21:38:59 +0100 Subject: Add test for == operator --- testing/templates/eq.html | 1 + testing/tests/comparison.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 testing/templates/eq.html create mode 100644 testing/tests/comparison.rs diff --git a/testing/templates/eq.html b/testing/templates/eq.html new file mode 100644 index 0000000..44666d3 --- /dev/null +++ b/testing/templates/eq.html @@ -0,0 +1 @@ +{% if a == b %}t{% endif %}{% if a == c %}t{% else %}f{% endif %} diff --git a/testing/tests/comparison.rs b/testing/tests/comparison.rs new file mode 100644 index 0000000..2e34bc0 --- /dev/null +++ b/testing/tests/comparison.rs @@ -0,0 +1,19 @@ +extern crate askama; +#[macro_use] +extern crate askama_derive; + +use askama::Template; + +#[derive(Template)] +#[template(path = "eq.html")] +struct EqTemplate { + a: usize, + b: usize, + c: usize, +} + +#[test] +fn test_eq() { + let t = EqTemplate { a: 1, b: 1, c: 2 }; + assert_eq!(t.render(), "tf\n"); +} -- cgit