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
This commit is contained in:
Guilherme Carreiro
2025-10-27 16:33:31 +01:00
committed by Guilherme Carreiro
parent e413104e78
commit 75c95d0791
2 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -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)
+4 -5
View File
@@ -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