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