summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-02-12 00:22:22 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-02-12 00:22:22 +0000
commita0c354ee4ed02bb3f958dfb029d29b76e6637952 (patch)
treeb91d1196ab7675efca2a3201258d1c9644f722e0 /tests/regressiontests
parentd123588184dfecc286e8e06e16dc0383f435c051 (diff)
Fixed #3351 -- Added optional naming of the block in "endblock" tags to ensure
correct nesting. Thanks for the patch, SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/templates/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index 0a41f5b5b7..620825b254 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -390,6 +390,21 @@ class Templates(unittest.TestCase):
'include03': ('{% include template_name %}', {'template_name': 'basic-syntax02', 'headline': 'Included'}, "Included"),
'include04': ('a{% include "nonexistent" %}b', {}, "ab"),
+ ### NAMED ENDBLOCKS #######################################################
+
+ # Basic test
+ 'namedendblocks01': ("1{% block first %}_{% block second %}2{% endblock second %}_{% endblock first %}3", {}, '1_2_3'),
+
+ # Unbalanced blocks
+ 'namedendblocks02': ("1{% block first %}_{% block second %}2{% endblock first %}_{% endblock %}3", {}, template.TemplateSyntaxError),
+ 'namedendblocks03': ("1{% block first %}_{% block second %}2{% endblock %}_{% endblock second %}3", {}, template.TemplateSyntaxError),
+ 'namedendblocks04': ("1{% block first %}_{% block second %}2{% endblock second %}_{% endblock third %}3", {}, template.TemplateSyntaxError),
+ 'namedendblocks05': ("1{% block first %}_{% block second %}2{% endblock first %}", {}, template.TemplateSyntaxError),
+
+ # Mixed named and unnamed endblocks
+ 'namedendblocks06': ("1{% block first %}_{% block second %}2{% endblock %}_{% endblock first %}3", {}, '1_2_3'),
+ 'namedendblocks07': ("1{% block first %}_{% block second %}2{% endblock second %}_{% endblock %}3", {}, '1_2_3'),
+
### INHERITANCE ###########################################################
# Standard template with no inheritance