mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 07:20:55 +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 %}
|
{% for s in strings %}
|
||||||
{{- loop.index0 }}. {{ s }}
|
{{- loop.index0 }}. {{ s }}{% if loop.first %} (first){% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -14,7 +14,7 @@ fn test_for() {
|
|||||||
let s = ForTemplate {
|
let s = ForTemplate {
|
||||||
strings: vec!["A", "alfa", "1"],
|
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)]
|
#[derive(Template)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user