From ad53bd9fbac69fa0076bba6621c52ab27b3b4c3f Mon Sep 17 00:00:00 2001 From: "Thomas E. Enebo" Date: Thu, 4 Mar 2021 14:01:58 -0600 Subject: [PATCH] chunk {|*a| } should treat array as single value --- spec/ruby/core/enumerable/chunk_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/ruby/core/enumerable/chunk_spec.rb b/spec/ruby/core/enumerable/chunk_spec.rb index 548544f4e8c..6b74b6f8baf 100644 --- a/spec/ruby/core/enumerable/chunk_spec.rb +++ b/spec/ruby/core/enumerable/chunk_spec.rb @@ -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