mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 19:00:39 -07:00
Update some Drop tests
This commit is contained in:
@@ -63,6 +63,22 @@ class EnumerableDrop < Liquid::Drop
|
|||||||
3
|
3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def first
|
||||||
|
1
|
||||||
|
end
|
||||||
|
|
||||||
|
def count
|
||||||
|
3
|
||||||
|
end
|
||||||
|
|
||||||
|
def min
|
||||||
|
1
|
||||||
|
end
|
||||||
|
|
||||||
|
def max
|
||||||
|
3
|
||||||
|
end
|
||||||
|
|
||||||
def each
|
def each
|
||||||
yield 1
|
yield 1
|
||||||
yield 2
|
yield 2
|
||||||
@@ -200,11 +216,15 @@ class DropsTest < Test::Unit::TestCase
|
|||||||
[ :count, :max ].each do |method|
|
[ :count, :max ].each do |method|
|
||||||
assert_equal "3", Liquid::Template.parse("{{collection.#{method}}}").render('collection' => RealEnumerableDrop.new)
|
assert_equal "3", Liquid::Template.parse("{{collection.#{method}}}").render('collection' => RealEnumerableDrop.new)
|
||||||
assert_equal "3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render('collection' => RealEnumerableDrop.new)
|
assert_equal "3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render('collection' => RealEnumerableDrop.new)
|
||||||
|
assert_equal "3", Liquid::Template.parse("{{collection.#{method}}}").render('collection' => EnumerableDrop.new)
|
||||||
|
assert_equal "3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render('collection' => EnumerableDrop.new)
|
||||||
end
|
end
|
||||||
|
|
||||||
[ :min, :first ].each do |method|
|
[ :min, :first ].each do |method|
|
||||||
assert_equal "1", Liquid::Template.parse("{{collection.#{method}}}").render('collection' => RealEnumerableDrop.new)
|
assert_equal "1", Liquid::Template.parse("{{collection.#{method}}}").render('collection' => RealEnumerableDrop.new)
|
||||||
assert_equal "1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render('collection' => RealEnumerableDrop.new)
|
assert_equal "1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render('collection' => RealEnumerableDrop.new)
|
||||||
|
assert_equal "1", Liquid::Template.parse("{{collection.#{method}}}").render('collection' => EnumerableDrop.new)
|
||||||
|
assert_equal "1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render('collection' => EnumerableDrop.new)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user