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 | 69846644d25b0a40ab787b150716a5d17e63f6a8 (patch) | |
tree | e2f3fc0fdbfaddcd5a7187dcc631c0103e28f1b1 /test | |
parent | 468301b98487d3b2b0d9e4a60c912803f4ba39f0 (diff) |
* 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 |