Fixed a macro scoping bug discovered by ckknight introduced in one of the earlier changes for the 2.1 release.
--HG--
branch : trunk
diff --git a/tests/test_inheritance.py b/tests/test_inheritance.py
index 8884b9f..bb86b41 100644
--- a/tests/test_inheritance.py
+++ b/tests/test_inheritance.py
@@ -131,3 +131,38 @@
assert tmpl.render(master='master2') == 'MASTER2CHILD'
assert tmpl.render(master='master1') == 'MASTER1CHILD'
assert tmpl.render() == 'MASTER1CHILD'
+
+
+def test_fixed_macro_scoping_bug():
+ assert Environment(loader=DictLoader({
+ 'test.html': '''\
+ {% extends 'details.html' %}
+
+ {% macro my_macro() %}
+ my_macro
+ {% endmacro %}
+
+ {% block inner_box %}
+ {{ my_macro() }}
+ {% endblock %}
+ ''',
+ 'details.html': '''\
+ {% extends 'standard.html' %}
+
+ {% macro my_macro() %}
+ my_macro
+ {% endmacro %}
+
+ {% block content %}
+ {% block outer_box %}
+ outer_box
+ {% block inner_box %}
+ inner_box
+ {% endblock %}
+ {% endblock %}
+ {% endblock %}
+ ''',
+ 'standard.html': '''
+ {% block content %} {% endblock %}
+ '''
+ })).get_template("test.html").render().split() == [u'outer_box', u'my_macro']