Add test for 'loop.first' variable

This commit is contained in:
Dirkjan Ochtman 2018-06-25 12:46:13 +02:00
parent fc0863f40b
commit 9a3c57ac34
2 changed files with 2 additions and 2 deletions

View File

@ -1,3 +1,3 @@
{% for s in strings %}
{{- loop.index0 }}. {{ s }}
{{- loop.index0 }}. {{ s }}{% if loop.first %} (first){% endif %}
{% endfor %}

View File

@ -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)]