summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Beaven <smileychris@gmail.com>2011-07-25 22:18:59 +0000
committerChris Beaven <smileychris@gmail.com>2011-07-25 22:18:59 +0000
commit34a71dc4e4c1f09da7fd47a566c4ae5965bc2f42 (patch)
treeb2162682f7031fa57ab8f53290fb1812d9ce1b49
parentafd8a47df7b66a52a310c62a6385d45f7c17c1a0 (diff)
Add some simple regression tests for the truncatechars filter. Refs #16510.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16551 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/regressiontests/templates/filters.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/filters.py b/tests/regressiontests/templates/filters.py
index 9ada4fb26e..65f98e9ede 100644
--- a/tests/regressiontests/templates/filters.py
+++ b/tests/regressiontests/templates/filters.py
@@ -134,6 +134,9 @@ def get_filter_tests():
'filter-truncatewords02': ('{{ a|truncatewords:"2" }} {{ b|truncatewords:"2"}}',
{"a": "alpha & bravo", "b": mark_safe("alpha &amp; bravo")}, u"alpha &amp; ... alpha &amp; ..."),
+ 'filter-truncatechars01': ('{{ a|truncatechars:5 }}', {'a': "Testing, testing"}, u"Te..."),
+ 'filter-truncatechars02': ('{{ a|truncatechars:7 }}', {'a': "Testing"}, u"Testing"),
+
# The "upper" filter messes up entities (which are case-sensitive),
# so it's not safe for non-escaping purposes.
'filter-upper01': ('{% autoescape off %}{{ a|upper }} {{ b|upper }}{% endautoescape %}', {"a": "a & b", "b": mark_safe("a &amp; b")}, u"A & B A &AMP; B"),