From: Armin Ronacher Date: Sat, 6 Feb 2010 18:01:58 +0000 (+0100) Subject: Added a testcase for #363. This bug was fixed along the way. X-Git-Tag: 2.3~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fd4ad638cd14cdc20bd6b19ccd8e0ea111b3aef;p=thirdparty%2Fjinja.git Added a testcase for #363. This bug was fixed along the way. --HG-- branch : trunk --- diff --git a/Makefile b/Makefile index 6cd734ae..85ed64de 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ test: rm -rf py3k mkdir py3k cp -R jinja2 py3k - 2to3 jinja2 > py3k/convert.patch + cp -R tests py3k + 2to3 jinja2 tests > py3k/convert.patch cd py3k; patch -p0 < convert.patch .PHONY: test diff --git a/tests/test_old_bugs.py b/tests/test_old_bugs.py index 98db1b3b..9ca83446 100644 --- a/tests/test_old_bugs.py +++ b/tests/test_old_bugs.py @@ -140,3 +140,33 @@ def test_empty_if_condition_fails(): assert_raises(TemplateSyntaxError, Template, '{% if %}....{% endif %}') assert_raises(TemplateSyntaxError, Template, '{% if foo %}...{% elif %}...{% endif %}') assert_raises(TemplateSyntaxError, Template, '{% for x in %}..{% endfor %}') + + +def test_recursive_loop_bug(): + tpl1 = Template(""" + {% for p in foo recursive%} + {{p.bar}} + {% for f in p.fields recursive%} + {{f.baz}} + {{p.bar}} + {% if f.rec %} + {{ loop(f.sub) }} + {% endif %} + {% endfor %} + {% endfor %} + """) + tpl1.render(ctx) + + tpl2 = Template(""" + {% for p in foo%} + {{p.bar}} + {% for f in p.fields recursive%} + {{f.baz}} + {{p.bar}} + {% if f.rec %} + {{ loop(f.sub) }} + {% endif %} + {% endfor %} + {% endfor %} + """) + tpl2.render(ctx)