From 75c95d0791724a509027ae9ead327c5d855e8cd8 Mon Sep 17 00:00:00 2001 From: Guilherme Carreiro Date: Thu, 2 Oct 2025 10:24:32 +0200 Subject: [PATCH] Fix cycle tag - `respond_to?` was returning `false` in the parser switcher because `rigid_parse` was private It was working before because `parse_context` was doing the double-parsing thing, but when we removed that, this test fairly started breaking --- lib/liquid/tags/cycle.rb | 4 ++-- test/integration/tags/cycle_tag_test.rb | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/liquid/tags/cycle.rb b/lib/liquid/tags/cycle.rb index ad1058bd..2df55bfb 100644 --- a/lib/liquid/tags/cycle.rb +++ b/lib/liquid/tags/cycle.rb @@ -52,8 +52,6 @@ module Liquid output end - private - # cycle [name:] expression(, expression)* def rigid_parse(markup) p = @parse_context.new_parser(markup) @@ -73,6 +71,8 @@ module Liquid raise_syntax_error(options) if @variables.empty? end + private + # Temporarily until we migrate def strict_parse(markup) lax_parse(markup) diff --git a/test/integration/tags/cycle_tag_test.rb b/test/integration/tags/cycle_tag_test.rb index 8452c467..8cd6daac 100644 --- a/test/integration/tags/cycle_tag_test.rb +++ b/test/integration/tags/cycle_tag_test.rb @@ -55,10 +55,9 @@ class CycleTagTest < Minitest::Test end end - skip("todo(guilherme): parse_context.safe_parse_expression in progress...") - # with_error_mode(:rigid) do - # assert_raises(Liquid::SyntaxError) { Template.parse("{% cycle .5: 'a', 'b' %}") } - # assert_raises(Liquid::SyntaxError) { Template.parse("{% cycle .5, .4 %}") } - # end + with_error_mode(:rigid) do + assert_raises(Liquid::SyntaxError) { Template.parse("{% cycle .5: 'a', 'b' %}") } + assert_raises(Liquid::SyntaxError) { Template.parse("{% cycle .5, .4 %}") } + end end end