Skip to content

Commit

Permalink
chunk {|*a| } should treat array as single value
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Mar 4, 2021
1 parent 30d5761 commit ad53bd9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/ruby/core/enumerable/chunk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
result.should == [[:_alone, [1]], [false, [2, 3, 2]], [:_alone, [1]]]
end

it "yields Arrays as a single argument to a rest argument" do
e = EnumerableSpecs::Numerous.new([1, 2])
result = e.chunk { |*x| x.should == [[1,2]] }.to_a
end


it "does not return elements for which the block returns :_separator" do
e = EnumerableSpecs::Numerous.new(1, 2, 3, 3, 2, 1)
result = e.chunk { |x| x == 2 ? :_separator : 1 }.to_a
Expand Down

0 comments on commit ad53bd9

Please sign in to comment.