From fb11c175b27564a208148c0734200af0d981a0c8 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 15 Aug 2017 07:46:57 +0200 Subject: Add test for let blocks --- testing/templates/let.html | 1 + testing/tests/vars.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 testing/templates/let.html create mode 100644 testing/tests/vars.rs diff --git a/testing/templates/let.html b/testing/templates/let.html new file mode 100644 index 0000000..5b19255 --- /dev/null +++ b/testing/templates/let.html @@ -0,0 +1 @@ +{% let v = s %}{{ v }} diff --git a/testing/tests/vars.rs b/testing/tests/vars.rs new file mode 100644 index 0000000..53e3397 --- /dev/null +++ b/testing/tests/vars.rs @@ -0,0 +1,16 @@ +#[macro_use] +extern crate askama; + +use askama::Template; + +#[derive(Template)] +#[template(path = "let.html")] +struct LetTemplate<'a> { + s: &'a str, +} + +#[test] +fn test_let() { + let t = LetTemplate { s: "foo" }; + assert_eq!(t.render().unwrap(), "foo"); +} -- cgit