Skip to content

Commit da6ac75

Browse files
committed
Add failing test case for askama-rs#708
1 parent cf160a7 commit da6ac75

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

testing/templates/macro-iter.html.j2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{%- macro list(list) -%}
2+
<ul>
3+
{%- for item in list %}
4+
<li>{{item}}</li>
5+
{%- endfor %}
6+
</ul>
7+
<ol>
8+
{%- for item in list %}
9+
<li>{{item}}</li>
10+
{%- endfor %}
11+
</ol>
12+
{%- endmacro -%}
13+
14+
{%- for foo in foos %}
15+
{% call list(foo.list) %}
16+
{%- endfor %}

testing/tests/macro.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use askama::Template;
2+
use std::collections::BTreeSet;
23

34
#[derive(Template)]
45
#[template(path = "macro.html")]
@@ -73,3 +74,13 @@ fn str_cmp() {
7374
let t = StrCmpTemplate;
7475
assert_eq!(t.render().unwrap(), "AfooBotherCneitherD");
7576
}
77+
78+
#[derive(Template)]
79+
#[template(path = "macro-iter.html.j2")]
80+
struct MacroIterTemplate {
81+
foos: Vec<Foo>,
82+
}
83+
84+
struct Foo {
85+
list: BTreeSet<String>,
86+
}

0 commit comments

Comments
 (0)