From: Armin Ronacher Date: Mon, 19 May 2008 07:28:17 +0000 (+0200) Subject: added unittest for the latest fixed bug X-Git-Tag: 2.0rc1~40 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=24db451787fb3b966bca0eaf3ad4205fa8aaabf6;p=jinja2.git added unittest for the latest fixed bug --HG-- branch : trunk --- diff --git a/tests/test_forloop.py b/tests/test_forloop.py index 4cdb3bb..7469f93 100644 --- a/tests/test_forloop.py +++ b/tests/test_forloop.py @@ -24,6 +24,12 @@ NONITER = '''{% for item in none %}...{% endfor %}''' RECURSIVE = '''{% for item in seq recursive -%} [{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}] {%- endfor %}''' +LOOPLOOP = '''{% for row in table %} + {%- set rowloop = loop -%} + {% for cell in row -%} + [{{ rowloop.index }}|{{ loop.index }}] + {%- endfor %} +{%- endfor %}''' def test_simple(env): @@ -91,3 +97,8 @@ def test_recursive(env): dict(a=2, b=[dict(a=1), dict(a=2)]), dict(a=3, b=[dict(a='a')]) ]) == '[1<[1][2]>][2<[1][2]>][3<[a]>]' + + +def test_looploop(env): + tmpl = env.from_string(LOOPLOOP) + assert tmpl.render(table=['ab', 'cd']) == '[1|1][1|2][2|1][2|2]'