Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jan 18, 2025
1 parent 3c50a7f commit 3e3ff28
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions minijinja/tests/inputs/loop_break_one_shot_iter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{}
---
normal iteration does not lose items:
{% for item in one_shot_iterator %}{{ item }}{% if item == 1 %}{% break %}{% endif %}{% endfor %}
{%- for item in one_shot_iterator %}{{ item }}{% endfor %}
5 changes: 5 additions & 0 deletions minijinja/tests/inputs/loop_break_one_shot_iter_peek.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{}
---
peeking loses items:
{% for item in one_shot_iterator %}{{ item }}(next: {{ loop.nextitem }}){% if item == 0 %}{% break %}{% endif %}{% endfor %}
{%- for item in one_shot_iterator %}{{ item }}(next: {{ loop.nextitem }}){% endfor %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
source: minijinja/tests/test_templates.rs
description: "normal iteration does not lose items:\n{% for item in one_shot_iterator %}{{ item }}{% if item == 1 %}{% break %}{% endif %}{% endfor %}\n{%- for item in one_shot_iterator %}{{ item }}{% endfor %}"
info: {}
input_file: minijinja/tests/inputs/loop_break_one_shot_iter.txt
---
normal iteration does not lose items:
012
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
source: minijinja/tests/test_templates.rs
description: "peeking loses items:\n{% for item in one_shot_iterator %}{{ item }}(next: {{ loop.nextitem }}){% if item == 0 %}{% break %}{% endif %}{% endfor %}\n{%- for item in one_shot_iterator %}{{ item }}(next: {{ loop.nextitem }}){% endfor %}"
info: {}
input_file: minijinja/tests/inputs/loop_break_one_shot_iter_peek.txt
---
peeking loses items:
0(next: 1)2(next: )

0 comments on commit 3e3ff28

Please sign in to comment.