summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-27 12:16:22 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-27 12:16:22 +0000
commit54f11ee63c619b9348dbbb3b4493157442ddf6d8 (patch)
tree75376039f2862d5ed4680bb8f55dff47f5acd91a /tests
parent6fe5235cea1f21ef3f2efba0ebcb0906ad74e0aa (diff)
Fixed #4164, #4171 -- Reworked some of the template lexer logic to ensure we
don't get caught out by a couple of corner cases. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/templates/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index 2b33c53eb1..4e321b2d2b 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -127,6 +127,18 @@ class Templates(unittest.TestCase):
# Fail silently when accessing a non-simple method
'basic-syntax20': ("{{ var.method2 }}", {"var": SomeClass()}, ("","INVALID")),
+ # Don't get confused when parsing something that is almost, but not
+ # quite, a template tag.
+ 'basic-syntax21': ("a {{ moo %} b", {}, "a {{ moo %} b"),
+ 'basic-syntax22': ("{{ moo #}", {}, "{{ moo #}"),
+
+ # Will try to treat "moo #} {{ cow" as the variable. Not ideal, but
+ # costly to work around, so this triggers an error.
+ 'basic-syntax23': ("{{ moo #} {{ cow }}", {"cow": "cow"}, template.TemplateSyntaxError),
+
+ # Embedded newlines make it not-a-tag.
+ 'basic-syntax24': ("{{ moo\n }}", {}, "{{ moo\n }}"),
+
# List-index syntax allows a template to access a certain item of a subscriptable object.
'list-index01': ("{{ var.1 }}", {"var": ["first item", "second item"]}, "second item"),