A better fix for "and"/"or" in strings

(now with less side effects)
This commit is contained in:
James MacAulay
2009-09-23 15:44:29 -04:00
parent f42ce88456
commit 11dc18bfdf
4 changed files with 22 additions and 15 deletions
+13
View File
@@ -38,4 +38,17 @@ class ParsingQuirksTest < Test::Unit::TestCase
end
end
def test_meaningless_parens
assigns = {'b' => 'bar', 'c' => 'baz'}
markup = "a == 'foo' or (b == 'bar' and c == 'baz') or false"
assert_template_result(' YES ',"{% if #{markup} %} YES {% endif %}", assigns)
end
def test_unexpected_characters_silently_eat_logic
markup = "true && false"
assert_template_result(' YES ',"{% if #{markup} %} YES {% endif %}")
markup = "false || true"
assert_template_result('',"{% if #{markup} %} YES {% endif %}")
end
end