aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar bott <mhpoin@gmail.com>2018-09-21 02:09:59 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-09-21 13:42:56 +0200
commit94bb47a78d32c5a5162ce5475b8a4c310940fef2 (patch)
tree2a221067faf5b32e060582a5522ef3b2bd5c17ad /testing/tests
parentba91884d762bcf0b4a5bd9ca18d14be240570316 (diff)
downloadaskama-94bb47a78d32c5a5162ce5475b8a4c310940fef2.tar.gz
askama-94bb47a78d32c5a5162ce5475b8a4c310940fef2.tar.bz2
askama-94bb47a78d32c5a5162ce5475b8a4c310940fef2.zip
fix panicked on range-based for loop
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/loops.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
index 70ebb21..a0736f5 100644
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops.rs
@@ -46,3 +46,16 @@ fn test_precedence_for() {
};
assert_eq!(s.render().unwrap(), "0. A2 (first)\n1. alfa4\n2. 16\n");
}
+
+#[derive(Template)]
+#[template(path = "for-range.html")]
+struct ForRangeTemplate {
+ init: i32,
+ end: i32,
+}
+
+#[test]
+fn test_for_range() {
+ let s = ForRangeTemplate { init: -1, end: 1 };
+ assert_eq!(s.render().unwrap(), "foo\nfoo\nbar\nbar\nfoo\nbar\nbar\n");
+}