mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Merge pull request #412 from Shopify/assign-strict
Pass through options on assign tag
This commit is contained in:
@@ -15,7 +15,7 @@ module Liquid
|
|||||||
super
|
super
|
||||||
if markup =~ Syntax
|
if markup =~ Syntax
|
||||||
@to = $1
|
@to = $1
|
||||||
@from = Variable.new($2)
|
@from = Variable.new($2,options)
|
||||||
else
|
else
|
||||||
raise SyntaxError.new options[:locale].t("errors.syntax.assign".freeze)
|
raise SyntaxError.new options[:locale].t("errors.syntax.assign".freeze)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,4 +24,15 @@ class AssignTest < Minitest::Test
|
|||||||
'{% assign foo not values %}.',
|
'{% assign foo not values %}.',
|
||||||
'values' => "foo,bar,baz")
|
'values' => "foo,bar,baz")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_assign_uses_error_mode
|
||||||
|
with_error_mode(:strict) do
|
||||||
|
assert_raises(SyntaxError) do
|
||||||
|
Template.parse("{% assign foo = ('X' | downcase) %}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
with_error_mode(:lax) do
|
||||||
|
assert Template.parse("{% assign foo = ('X' | downcase) %}")
|
||||||
|
end
|
||||||
|
end
|
||||||
end # AssignTest
|
end # AssignTest
|
||||||
|
|||||||
Reference in New Issue
Block a user