more unittests and updated documentation for extensions. Fixed bug in optimizer that caused blocks to be optimized away under some circumstances.
--HG--
branch : trunk
diff --git a/tests/test_inheritance.py b/tests/test_inheritance.py
index 114ec9c..ee8296a 100644
--- a/tests/test_inheritance.py
+++ b/tests/test_inheritance.py
@@ -98,3 +98,12 @@
def test_reuse_blocks(env):
tmpl = env.from_string('{{ self.foo() }}|{% block foo %}42{% endblock %}|{{ self.foo() }}')
assert tmpl.render() == '42|42|42'
+
+
+def test_preserve_blocks():
+ env = Environment(loader=DictLoader({
+ 'a': '{% if false %}{% block x %}A{% endblock %}{% endif %}{{ self.x() }}',
+ 'b': '{% extends "a" %}{% block x %}B{{ super() }}{% endblock %}'
+ }))
+ tmpl = env.get_template('b')
+ assert tmpl.render() == 'BA'