aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-25 12:46:13 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-25 12:46:13 +0200
commit9a3c57ac34c3507282828de4ef4f7ebbfb014f81 (patch)
tree7767ad056d7f770490af199fc5c6080b9580987e
parentfc0863f40b64ff927a3aa1261b3d8d30afe68d85 (diff)
downloadaskama-9a3c57ac34c3507282828de4ef4f7ebbfb014f81.tar.gz
askama-9a3c57ac34c3507282828de4ef4f7ebbfb014f81.tar.bz2
askama-9a3c57ac34c3507282828de4ef4f7ebbfb014f81.zip
Add test for 'loop.first' variable
Diffstat (limited to '')
-rw-r--r--testing/templates/for.html2
-rw-r--r--testing/tests/loops.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/testing/templates/for.html b/testing/templates/for.html
index f63df9d..8b4032d 100644
--- a/testing/templates/for.html
+++ b/testing/templates/for.html
@@ -1,3 +1,3 @@
{% for s in strings %}
- {{- loop.index0 }}. {{ s }}
+ {{- loop.index0 }}. {{ s }}{% if loop.first %} (first){% endif %}
{% endfor %}
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
index 32f0aca..ac19d43 100644
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops.rs
@@ -14,7 +14,7 @@ fn test_for() {
let s = ForTemplate {
strings: vec!["A", "alfa", "1"],
};
- assert_eq!(s.render().unwrap(), "0. A\n1. alfa\n2. 1\n");
+ assert_eq!(s.render().unwrap(), "0. A (first)\n1. alfa\n2. 1\n");
}
#[derive(Template)]