diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-14 08:54:19 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-14 08:54:19 +0000 |
commit | 1a87c6cfa695da5771c7e8a02f9e389f402c89b9 (patch) | |
tree | a3709de71f012dfd0154d9ede1d4b8f3d085b364 /test/ruby | |
parent | eb15c01dafb9d84346fad8363d7f4e3c476b96a4 (diff) | |
download | ruby-1a87c6cfa695da5771c7e8a02f9e389f402c89b9.tar.gz |
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_enum.rb | 5 |
1 files changed, 5 insertions, 0 deletions
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' }) |