mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 10:20:43 -07:00
A better fix for "and"/"or" in strings
(now with less side effects)
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user