mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-29 22:11:17 +00:00
Add test for 'loop.first' variable
This commit is contained in:
parent
fc0863f40b
commit
9a3c57ac34
@ -1,3 +1,3 @@
|
||||
{% for s in strings %}
|
||||
{{- loop.index0 }}. {{ s }}
|
||||
{{- loop.index0 }}. {{ s }}{% if loop.first %} (first){% endif %}
|
||||
{% endfor %}
|
||||
|
@ -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)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user