if blocks work with filtered variables

This commit is contained in:
James MacAulay
2008-10-15 17:02:26 -04:00
parent 69bc84b777
commit 282786d7e2
5 changed files with 24 additions and 5 deletions
+7
View File
@@ -112,6 +112,13 @@ class IfElseTest < Test::Unit::TestCase
assert_template_result('elsif','{% if false %}if{% elsif true %}elsif{% endif %}')
end
def test_with_filtered_expressions
assert_template_result('yes','{% if "BLAH"|downcase == "blah" %}yes{% endif %}')
assert_template_result('yes','{% if "FOO BAR"|truncatewords:1,"--" == "FOO--" %}yes{% endif %}')
assert_template_result('yes','{% if "FOO BAR"|truncatewords:1,"--"|downcase == "foo--" %}yes{% endif %}')
assert_template_result('yes','{% if "foo--" == "FOO BAR"|truncatewords:1,"--"|downcase %}yes{% endif %}')
end
def test_syntax_error_no_variable
assert_raise(SyntaxError){ assert_template_result('', '{% if jerry == 1 %}')}
end