diff --git a/lib/liquid/tags/cycle.rb b/lib/liquid/tags/cycle.rb index 60f44d04..51fa9714 100644 --- a/lib/liquid/tags/cycle.rb +++ b/lib/liquid/tags/cycle.rb @@ -78,6 +78,7 @@ module Liquid # Parse remaining comma-separated expressions while p.consume?(:comma) break if p.look(:end_of_string) + @variables << maybe_dup_lookup(safe_parse_expression(p)) end diff --git a/test/integration/expression_test.rb b/test/integration/expression_test.rb index 918f87c2..71969900 100644 --- a/test/integration/expression_test.rb +++ b/test/integration/expression_test.rb @@ -26,8 +26,12 @@ class ExpressionTest < Minitest::Test def test_float assert_template_result("-17.42", "{{ -17.42 }}") assert_template_result("2.5", "{{ 2.5 }}") - assert_expression_result(0.0, "0.....5") - assert_expression_result(0.0, "-0..1") + + with_error_mode(:lax) do + assert_expression_result(0.0, "0.....5") + assert_expression_result(0.0, "-0..1") + end + assert_expression_result(1.5, "1.5") # this is a unfortunate quirky behavior of Liquid @@ -61,6 +65,7 @@ class ExpressionTest < Minitest::Test assert_template_result( "", "{{ - 'theme.css' - }}", + error_mode: :lax, ) end diff --git a/test/integration/tags/cycle_tag_test.rb b/test/integration/tags/cycle_tag_test.rb index b0ee6925..c41fb68e 100644 --- a/test/integration/tags/cycle_tag_test.rb +++ b/test/integration/tags/cycle_tag_test.rb @@ -3,7 +3,6 @@ require 'test_helper' class CycleTagTest < Minitest::Test - def test_simple_cycle_inside_for_loop template = <<~LIQUID {%- for i in (1..3) -%} diff --git a/test/integration/tags/table_row_test.rb b/test/integration/tags/table_row_test.rb index ad12d76f..81444945 100644 --- a/test/integration/tags/table_row_test.rb +++ b/test/integration/tags/table_row_test.rb @@ -138,7 +138,7 @@ class TableRowTest < Minitest::Test def test_tablerow_loop_drop_attributes template = <<~LIQUID.chomp - {% tablerow i in (1...2) %} + {% tablerow i in (1..2) %} col: {{ tablerowloop.col }} col0: {{ tablerowloop.col0 }} col_first: {{ tablerowloop.col_first }} @@ -192,12 +192,14 @@ class TableRowTest < Minitest::Test assert_template_result( "Liquid error (line 1): invalid integer", '{% tablerow n in (1...10) limit:true %} {{n}} {% endtablerow %}', + error_mode: :warn, render_errors: true, ) assert_template_result( "Liquid error (line 1): invalid integer", '{% tablerow n in (1...10) offset:true %} {{n}} {% endtablerow %}', + error_mode: :warn, render_errors: true, ) @@ -205,18 +207,19 @@ class TableRowTest < Minitest::Test "Liquid error (line 1): invalid integer", '{% tablerow n in (1...10) cols:true %} {{n}} {% endtablerow %}', render_errors: true, + error_mode: :warn, ) end def test_table_row_handles_interrupts assert_template_result( "