summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-14 08:54:19 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-14 08:54:19 +0000
commit11aa7c9604055b252c5d84c6b8cb5e95be7bfafa (patch)
treea3709de71f012dfd0154d9ede1d4b8f3d085b364 /test
parent07736e3d7d4cf4c4411e5a238aa49f42237ed8db (diff)
* 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')
-rw-r--r--test/ruby/test_enum.rb5
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' })