diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-04 18:25:16 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-04 18:25:16 +0000 |
commit | 58fa21a04e316c256242f664e9a5d0edc00b30fa (patch) | |
tree | e2f3fc0fdbfaddcd5a7187dcc631c0103e28f1b1 /test | |
parent | 0c65aebf51733c994daeda08c3d634d7650eac64 (diff) | |
download | ruby-58fa21a04e316c256242f664e9a5d0edc00b30fa.tar.gz |
* enum.c: Make Enumerable#chunk with no block return
an Enumerator [#2172]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_enum.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index c87c60ac09..4ff4f88ca9 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -611,6 +611,12 @@ class TestEnumerable < Test::Unit::TestCase e = @obj.chunk {|elt| :_foo } assert_raise(RuntimeError) { e.to_a } + + e = @obj.chunk.with_index {|elt, i| elt - i } + assert_equal([[1, [1, 2, 3]], + [-2, [1, 2]]], e.to_a) + + assert_equal(4, (0..3).chunk.size) end def test_slice_before |