aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/vars.rs
diff options
context:
space:
mode:
authorLibravatar vallentin <mail@vallentin.dev>2020-12-23 15:11:53 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-12-25 22:42:44 +0100
commit20f34be742b27f18d944d60dcb3e04b822c6d9ef (patch)
tree4406d7bbb4ca3068b65ad7a54e5dbe2b4684744a /testing/tests/vars.rs
parentfd4ece308e851afe0653ab2b2ad2060914de7486 (diff)
downloadaskama-20f34be742b27f18d944d60dcb3e04b822c6d9ef.tar.gz
askama-20f34be742b27f18d944d60dcb3e04b822c6d9ef.tar.bz2
askama-20f34be742b27f18d944d60dcb3e04b822c6d9ef.zip
Added let shadow test
Diffstat (limited to '')
-rw-r--r--testing/tests/vars.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/tests/vars.rs b/testing/tests/vars.rs
index d1c41f9..d70a084 100644
--- a/testing/tests/vars.rs
+++ b/testing/tests/vars.rs
@@ -47,6 +47,27 @@ fn test_let_decl() {
}
#[derive(Template)]
+#[template(path = "let-shadow.html")]
+struct LetShadowTemplate {
+ cond: bool,
+}
+
+impl LetShadowTemplate {
+ fn tuple() -> (i32, i32) {
+ (4, 5)
+ }
+}
+
+#[test]
+fn test_let_shadow() {
+ let t = LetShadowTemplate { cond: true };
+ assert_eq!(t.render().unwrap(), "22-1-33-11-22");
+
+ let t = LetShadowTemplate { cond: false };
+ assert_eq!(t.render().unwrap(), "222-1-333-4-5-11-222");
+}
+
+#[derive(Template)]
#[template(source = "{% for v in self.0 %}{{ v }}{% endfor %}", ext = "txt")]
struct SelfIterTemplate(Vec<usize>);