The hopefully final fix for the bug apollo13 spotted earlier.

--HG--
branch : trunk
diff --git a/tests/test_old_bugs.py b/tests/test_old_bugs.py
index 08db225..62a9cd6 100644
--- a/tests/test_old_bugs.py
+++ b/tests/test_old_bugs.py
@@ -8,7 +8,8 @@
     :copyright: Copyright 2008 by Armin Ronacher.
     :license: BSD.
 """
-from jinja2 import Environment
+from jinja2 import Environment, DictLoader
+
 
 def test_keyword_folding():
     env = Environment()
@@ -16,3 +17,14 @@
     assert env.from_string("{{ 'test'|testing(some='stuff') }}") \
            .render() == 'teststuff'
 
+
+def test_extends_output_bugs():
+    env = Environment(loader=DictLoader({
+        'parent.html': '(({% block title %}{% endblock %}))'
+    }))
+
+    t = env.from_string('{% if expr %}{% extends "parent.html" %}{% endif %}'
+                        '[[{% block title %}title{% endblock %}]]'
+                        '{% for item in [1, 2, 3] %}({{ item }}){% endfor %}')
+    assert t.render(expr=False) == '[[title]](1)(2)(3)'
+    assert t.render(expr=True) == '((title))'