Fix FrozenError for blank case tag with multiple expression when tag (#1340)

This commit is contained in:
Dylan Thacker-Smith
2020-10-28 13:37:17 -04:00
committed by GitHub
parent 3a591fbf26
commit ea6e326b9c
2 changed files with 10 additions and 2 deletions

View File

@@ -22,8 +22,11 @@ module Liquid
body = new_body
body = @blocks.last.attachment while parse_body(body, tokens)
@blocks.each do |condition|
condition.attachment.remove_blank_strings if blank?
condition.attachment.freeze
body = condition.attachment
unless body.frozen?
body.remove_blank_strings if blank?
body.freeze
end
end
end

View File

@@ -213,6 +213,11 @@ class StandardTagTest < Minitest::Test
assert_template_result('', code, 'condition' => 'something else')
end
def test_case_when_comma_and_blank_body
code = '{% case condition %}{% when 1, 2 %} {% assign r = "result" %} {% endcase %}{{ r }}'
assert_template_result('result', code, 'condition' => 2)
end
def test_assign
assert_template_result('variable', '{% assign a = "variable"%}{{a}}')
end