aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/templates/let-decl.html7
-rw-r--r--testing/tests/vars.rs14
2 files changed, 21 insertions, 0 deletions
diff --git a/testing/templates/let-decl.html b/testing/templates/let-decl.html
new file mode 100644
index 0000000..d348903
--- /dev/null
+++ b/testing/templates/let-decl.html
@@ -0,0 +1,7 @@
+{% let val -%}
+{% if cond -%}
+ {% let val = "foo" -%}
+{% else -%}
+ {% let val = s -%}
+{% endif -%}
+{{ val }}
diff --git a/testing/tests/vars.rs b/testing/tests/vars.rs
index 53e3397..ab40665 100644
--- a/testing/tests/vars.rs
+++ b/testing/tests/vars.rs
@@ -14,3 +14,17 @@ fn test_let() {
let t = LetTemplate { s: "foo" };
assert_eq!(t.render().unwrap(), "foo");
}
+
+
+#[derive(Template)]
+#[template(path = "let-decl.html")]
+struct LetDeclTemplate<'a> {
+ cond: bool,
+ s: &'a str,
+}
+
+#[test]
+fn test_let_decl() {
+ let t = LetDeclTemplate { cond: false, s: "bar" };
+ assert_eq!(t.render().unwrap(), "bar");
+}