Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/liquid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 2 additions & 8 deletions test/integration/hash_rendering_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
8 changes: 1 addition & 7 deletions test/integration/standard_filter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down