mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
Ensure nil works as a variable name
This commit is contained in:
@@ -8,7 +8,11 @@ class IfElseTagTest < Minitest::Test
|
||||
assert_template_result(' this text should go into the output ',
|
||||
' {% if true %} this text should go into the output {% endif %} ')
|
||||
assert_template_result(' you rock ?','{% if false %} you suck {% endif %} {% if true %} you rock {% endif %}?')
|
||||
end
|
||||
|
||||
def test_literal_comparisons
|
||||
assert_template_result(' NO ','{% assign v = false %}{% if v %} YES {% else %} NO {% endif %}')
|
||||
assert_template_result(' YES ','{% assign v = nil %}{% if v == nil %} YES {% else %} NO {% endif %}')
|
||||
end
|
||||
|
||||
def test_if_else
|
||||
|
||||
@@ -34,6 +34,10 @@ class VariableTest < Minitest::Test
|
||||
assert_equal 'false', Template.parse("{{ false }}").render!
|
||||
end
|
||||
|
||||
def test_nil_operations
|
||||
assert_equal 'cat', Template.parse("{{ nil | append: 'cat' }}").render!
|
||||
end
|
||||
|
||||
def test_preset_assigns
|
||||
template = Template.parse(%|{{ test }}|)
|
||||
template.assigns['test'] = 'worked'
|
||||
|
||||
Reference in New Issue
Block a user