Add a rigid_parse method to cycle

This commit is contained in:
Charles-P. Clermont
2025-10-27 16:33:31 +01:00
committed by Guilherme Carreiro
parent 6d585a24f1
commit c78bf20010
2 changed files with 56 additions and 12 deletions
+15
View File
@@ -45,4 +45,19 @@ class CycleTagTest < Minitest::Test
assert_template_result("11", template)
end
def test_cycle_tag_with_error_mode
# QuotedFragment is more permissive than what Parser#expression allows.
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result("a", "{% cycle .5: 'a', 'b' %}")
assert_template_result("b", "{% assign 5 = 'b' %}{% cycle .5, .4 %}")
end
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