From 11aa7c9604055b252c5d84c6b8cb5e95be7bfafa Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 14 Jun 2015 08:54:19 +0000 Subject: * enum.c (enum_chunk_while): New method Enumerable#chunk_while. [ruby-core:67738] [Feature #10769] proposed by Tsuyoshi Sawada. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_enum.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 09f978502a..db03b7bb7b 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -659,6 +659,11 @@ class TestEnumerable < Test::Unit::TestCase assert_equal([[1], [4], [9,10,11,12], [15,16], [19,20,21]], e.to_a) end + def test_chunk_while_contiguously_increasing_integers + e = [1,4,9,10,11,12,15,16,19,20,21].chunk_while {|i, j| i+1 == j } + assert_equal([[1], [4], [9,10,11,12], [15,16], [19,20,21]], e.to_a) + end + def test_detect @obj = ('a'..'z') assert_equal('c', @obj.detect {|x| x == 'c' }) -- cgit v1.2.3