From cbeff64708ed74d2297d803e27b7b9b8b29af3d6 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Thu, 18 Dec 2025 13:56:02 -0500 Subject: [PATCH 1/2] Make new tests serializable to liquid-spec (No anonymous classes) --- test/integration/hash_rendering_test.rb | 10 ++-------- test/integration/standard_filter_test.rb | 8 +------- test/test_helper.rb | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/test/integration/hash_rendering_test.rb b/test/integration/hash_rendering_test.rb index 47e6288b3..0c1b33e48 100644 --- a/test/integration/hash_rendering_test.rb +++ b/test/integration/hash_rendering_test.rb @@ -88,17 +88,11 @@ def test_render_hash_with_hash_key end def test_rendering_hash_with_custom_to_s_method_uses_custom_to_s - my_hash = Class.new(Hash) do - def to_s - "kewl" - end - end.new - - assert_template_result("kewl", "{{ my_hash }}", { "my_hash" => my_hash }) + assert_template_result("kewl", "{{ my_hash }}", { "my_hash" => HashWithCustomToS.new }) end def test_rendering_hash_without_custom_to_s_uses_default_inspect - my_hash = Class.new(Hash).new + my_hash = HashWithoutCustomToS.new my_hash[:foo] = :bar assert_template_result("{:foo=>:bar}", "{{ my_hash }}", { "my_hash" => my_hash }) diff --git a/test/integration/standard_filter_test.rb b/test/integration/standard_filter_test.rb index e1370fae1..e27605ff5 100644 --- a/test/integration/standard_filter_test.rb +++ b/test/integration/standard_filter_test.rb @@ -294,13 +294,7 @@ def test_join end def test_join_calls_to_liquid_on_each_element - drop = Class.new(Liquid::Drop) do - def to_liquid - 'i did it' - end - end - - assert_equal('i did it, i did it', @filters.join([drop.new, drop.new], ", ")) + assert_equal('i did it, i did it', @filters.join([CustomToLiquidDrop.new('i did it'), CustomToLiquidDrop.new('i did it')], ", ")) end def test_sort diff --git a/test/test_helper.rb b/test/test_helper.rb index 293ea4766..a6d3e16e5 100755 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -199,6 +199,26 @@ def exception end end +class CustomToLiquidDrop < Liquid::Drop + def initialize(value) + @value = value + super() + end + + def to_liquid + @value + end +end + +class HashWithCustomToS < Hash + def to_s + "kewl" + end +end + +class HashWithoutCustomToS < Hash +end + class StubFileSystem attr_reader :file_read_count From bad29caaae0e374366d28eadf3b45fb07ae4ec01 Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Thu, 18 Dec 2025 15:39:13 -0500 Subject: [PATCH 2/2] Fixup GH action --- .github/workflows/liquid.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/liquid.yml b/.github/workflows/liquid.yml index e496f55f8..bd0df8e5b 100644 --- a/.github/workflows/liquid.yml +++ b/.github/workflows/liquid.yml @@ -22,17 +22,17 @@ jobs: rubyopt: "--enable-frozen-string-literal", } - { ruby: 3.4, allowed-failure: false, rubyopt: "--yjit" } - - { ruby: ruby-head, allowed-failure: false } + - { ruby: head, allowed-failure: false } - { - ruby: ruby-head, + ruby: head, allowed-failure: false, rubyopt: "--enable-frozen-string-literal", } - - { ruby: ruby-head, allowed-failure: false, rubyopt: "--yjit" } + - { ruby: head, allowed-failure: false, rubyopt: "--yjit" } name: Test Ruby ${{ matrix.entry.ruby }} steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - - uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0 + - uses: ruby/setup-ruby@a25f1e45f0e65a92fcb1e95e8847f78fb0a7197a # v1.273.0 with: ruby-version: ${{ matrix.entry.ruby }} bundler-cache: true @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - - uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0 + - uses: ruby/setup-ruby@a25f1e45f0e65a92fcb1e95e8847f78fb0a7197a # v1.273.0 with: bundler-cache: true - run: bundle exec rake memory_profile:run