summaryrefslogtreecommitdiff
path: root/test/ruby/test_enum.rb
diff options
context:
space:
mode:
authorTSUYUSATO Kitsune <make.just.on@gmail.com>2021-10-25 12:13:44 +0900
committerGitHub <noreply@github.com>2021-10-25 12:13:44 +0900
commitdfb47bbd17c3c2b8ce17dbafaf62df023b0224b2 (patch)
treef76585ae3d195837be9d929f96c396b6f627f0fd /test/ruby/test_enum.rb
parentaa09c8dae0ac2901264f2882467fac3083b52f32 (diff)
Fix `Enumerable#each_cons` and `Enumerable#each_slice` to return a receiver
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/1509 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'test/ruby/test_enum.rb')
-rw-r--r--test/ruby/test_enum.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 4674f984ff..702c332cd2 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -731,6 +731,8 @@ class TestEnumerable < Test::Unit::TestCase
ary.clear
(1..10).each_slice(11) {|a| ary << a}
assert_equal([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], ary)
+
+ assert_equal(1..10, (1..10).each_slice(3) { })
end
def test_each_cons
@@ -750,6 +752,8 @@ class TestEnumerable < Test::Unit::TestCase
ary.clear
(1..5).each_cons(6) {|a| ary << a}
assert_empty(ary)
+
+ assert_equal(1..5, (1..5).each_cons(3) { })
end
def test_zip