mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
QuotedStrings can be empty
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ module Liquid
|
|||||||
VariableStart = /\{\{/
|
VariableStart = /\{\{/
|
||||||
VariableEnd = /\}\}/
|
VariableEnd = /\}\}/
|
||||||
VariableIncompleteEnd = /\}\}?/
|
VariableIncompleteEnd = /\}\}?/
|
||||||
QuotedString = /"[^"]+"|'[^']+'/
|
QuotedString = /"[^"]*"|'[^']*'/
|
||||||
QuotedFragment = /#{QuotedString}|(?:[^\s,\|'"]|#{QuotedString})+/
|
QuotedFragment = /#{QuotedString}|(?:[^\s,\|'"]|#{QuotedString})+/
|
||||||
StrictQuotedFragment = /"[^"]+"|'[^']+'|[^\s,\|,\:,\,]+/
|
StrictQuotedFragment = /"[^"]+"|'[^']+'|[^\s,\|,\:,\,]+/
|
||||||
FirstFilterArgument = /#{FilterArgumentSeparator}(?:#{StrictQuotedFragment})/
|
FirstFilterArgument = /#{FilterArgumentSeparator}(?:#{StrictQuotedFragment})/
|
||||||
|
|||||||
@@ -326,6 +326,10 @@ HERE
|
|||||||
assert_equal 'variable', Liquid::Template.parse( '{% assign a = "variable"%}{{a}}' ).render
|
assert_equal 'variable', Liquid::Template.parse( '{% assign a = "variable"%}{{a}}' ).render
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_assign_an_empty_string
|
||||||
|
assert_equal '', Liquid::Template.parse( '{% assign a = ""%}{{a}}' ).render
|
||||||
|
end
|
||||||
|
|
||||||
def test_assign_is_global
|
def test_assign_is_global
|
||||||
assert_equal 'variable', Liquid::Template.parse( '{%for i in (1..2) %}{% assign a = "variable"%}{% endfor %}{{a}}' ).render
|
assert_equal 'variable', Liquid::Template.parse( '{%for i in (1..2) %}{% assign a = "variable"%}{% endfor %}{{a}}' ).render
|
||||||
end
|
end
|
||||||
@@ -347,6 +351,7 @@ HERE
|
|||||||
|
|
||||||
assert_template_result('one','{%cycle "one", "two"%}')
|
assert_template_result('one','{%cycle "one", "two"%}')
|
||||||
assert_template_result('one two','{%cycle "one", "two"%} {%cycle "one", "two"%}')
|
assert_template_result('one two','{%cycle "one", "two"%} {%cycle "one", "two"%}')
|
||||||
|
assert_template_result(' two','{%cycle "", "two"%} {%cycle "", "two"%}')
|
||||||
|
|
||||||
assert_template_result('one two one','{%cycle "one", "two"%} {%cycle "one", "two"%} {%cycle "one", "two"%}')
|
assert_template_result('one two one','{%cycle "one", "two"%} {%cycle "one", "two"%} {%cycle "one", "two"%}')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user