diff --git a/lib/liquid/tags/case.rb b/lib/liquid/tags/case.rb index 879fcb7..9aeb797 100644 --- a/lib/liquid/tags/case.rb +++ b/lib/liquid/tags/case.rb @@ -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 diff --git a/test/integration/tags/standard_tag_test.rb b/test/integration/tags/standard_tag_test.rb index 08b2aa0..ea7dca1 100644 --- a/test/integration/tags/standard_tag_test.rb +++ b/test/integration/tags/standard_tag_test.rb @@ -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