aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-15 07:46:57 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-15 07:47:02 +0200
commitfb11c175b27564a208148c0734200af0d981a0c8 (patch)
treec8cdf812bb8358849768a6bf45a2cb9e7aecf321
parent34fd0c07de86ff338e261a6454bad88661c07b2e (diff)
downloadaskama-fb11c175b27564a208148c0734200af0d981a0c8.tar.gz
askama-fb11c175b27564a208148c0734200af0d981a0c8.tar.bz2
askama-fb11c175b27564a208148c0734200af0d981a0c8.zip
Add test for let blocks
Diffstat (limited to '')
-rw-r--r--testing/templates/let.html1
-rw-r--r--testing/tests/vars.rs16
2 files changed, 17 insertions, 0 deletions
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");
+}