Fix strict parsing of find variable with a name expression

This commit is contained in:
Dylan Thacker-Smith
2020-10-19 12:07:39 -04:00
parent 420a1c79e1
commit 46fd63da5f
2 changed files with 9 additions and 0 deletions

View File

@@ -52,6 +52,11 @@ module Liquid
when :id
str = consume
str << variable_lookups
when :open_square
str = consume
str << expression
str << consume(:close_square)
str << variable_lookups
when :string, :number
consume
when :open_round

View File

@@ -95,4 +95,8 @@ class VariableTest < Minitest::Test
def test_render_symbol
assert_template_result('bar', '{{ foo }}', 'foo' => :bar)
end
def test_dynamic_find_var
assert_template_result('bar', '{{ [key] }}', 'key' => 'foo', 'foo' => 'bar')
end
end