mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Call to_liquid_value when short circuiting conditions
This commit is contained in:
@@ -69,9 +69,9 @@ module Liquid
|
|||||||
|
|
||||||
case condition.child_relation
|
case condition.child_relation
|
||||||
when :or
|
when :or
|
||||||
break if result
|
break if Liquid::Utils.to_liquid_value(result)
|
||||||
when :and
|
when :and
|
||||||
break unless result
|
break unless Liquid::Utils.to_liquid_value(result)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class VariableTest < Minitest::Test
|
|||||||
|
|
||||||
assert_template_result('', '{% if foo %}true{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
assert_template_result('', '{% if foo %}true{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
||||||
assert_template_result('', '{% if foo == true %}True{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
assert_template_result('', '{% if foo == true %}True{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
||||||
|
assert_template_result('', '{% if foo and true %}SHOULD NOT HAPPEN{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
||||||
|
|
||||||
assert_template_result('one', '{% if a contains x %}one{% endif %}', { 'a' => [1], 'x' => IntegerDrop.new(1) })
|
assert_template_result('one', '{% if a contains x %}one{% endif %}', { 'a' => [1], 'x' => IntegerDrop.new(1) })
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user