mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
Fix strict parsing of find variable with a name expression
This commit is contained in:
@@ -52,6 +52,11 @@ module Liquid
|
|||||||
when :id
|
when :id
|
||||||
str = consume
|
str = consume
|
||||||
str << variable_lookups
|
str << variable_lookups
|
||||||
|
when :open_square
|
||||||
|
str = consume
|
||||||
|
str << expression
|
||||||
|
str << consume(:close_square)
|
||||||
|
str << variable_lookups
|
||||||
when :string, :number
|
when :string, :number
|
||||||
consume
|
consume
|
||||||
when :open_round
|
when :open_round
|
||||||
|
|||||||
@@ -95,4 +95,8 @@ class VariableTest < Minitest::Test
|
|||||||
def test_render_symbol
|
def test_render_symbol
|
||||||
assert_template_result('bar', '{{ foo }}', 'foo' => :bar)
|
assert_template_result('bar', '{{ foo }}', 'foo' => :bar)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dynamic_find_var
|
||||||
|
assert_template_result('bar', '{{ [key] }}', 'key' => 'foo', 'foo' => 'bar')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user