mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 14:34:39 +02:00
* enum.c (enum_each_slice): Support for Enumerable#each_slice.size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c82ad6d207
commit
df8451e606
2 changed files with 29 additions and 1 deletions
|
@ -482,5 +482,13 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
def test_size_for_loops
|
||||
assert_equal Float::INFINITY, loop.size
|
||||
end
|
||||
|
||||
def test_size_for_each_slice
|
||||
assert_equal nil, @obj.each_slice(3).size
|
||||
assert_equal 6, @sized.each_slice(7).size
|
||||
assert_equal 5, @sized.each_slice(10).size
|
||||
assert_equal 1, @sized.each_slice(70).size
|
||||
assert_raise(ArgumentError){ @obj.each_slice(0).size }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue