mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Change return value of Enumerable#each_slice
More compatibility to CRuby.
This commit is contained in:
@@ -154,6 +154,7 @@ module Enumerable
|
||||
end
|
||||
end
|
||||
block.call(ary) unless ary.empty?
|
||||
nil
|
||||
end
|
||||
|
||||
##
|
||||
|
||||
@@ -31,8 +31,9 @@ end
|
||||
|
||||
assert("Enumerable#each_slice") do
|
||||
a = []
|
||||
(1..10).each_slice(3){|e| a << e}
|
||||
b = (1..10).each_slice(3){|e| a << e}
|
||||
assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]], a
|
||||
assert_equal nil, b
|
||||
end
|
||||
|
||||
assert("Enumerable#group_by") do
|
||||
|
||||
Reference in New Issue
Block a user