Skip to content

Commit

Permalink
Add spec for return value of Enumerable#each_slice when a block is given
Browse files Browse the repository at this point in the history
  • Loading branch information
ytjmt authored and eregon committed Oct 8, 2022
1 parent acc0833 commit 5b20199
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/enumerable/each_slice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
e.to_a.should == @sliced
end

ruby_version_is "3.1" do
it "returns self when a block is given" do
@enum.each_slice(3){}.should == @enum
end
end

it "gathers whole arrays as elements when each yields multiple" do
multi = EnumerableSpecs::YieldsMulti.new
multi.each_slice(2).to_a.should == [[[1, 2], [3, 4, 5]], [[6, 7, 8, 9]]]
Expand Down

0 comments on commit 5b20199

Please sign in to comment.