summaryrefslogtreecommitdiff
path: root/test/ruby/test_enum.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-16 14:47:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-16 14:47:38 +0000
commit118838ad3a808f1e22ff83ec2718b409fb251fbc (patch)
treea28502ea99cd963496b8beb6fdfbf48ea42b7145 /test/ruby/test_enum.rb
parentfcbd13b10ae48b326a573662f91b7b76e4da8334 (diff)
enum.c: fix condition to recycle block argument
* enum.c (dont_recycle_block_arg): fix condition to recycle block argument. lambda with rest can get internal array directly. [ruby-core:62060] [Bug #9749] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enum.rb')
-rw-r--r--test/ruby/test_enum.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 0fbfeebc2f..963cd94034 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -342,12 +342,22 @@ class TestEnumerable < Test::Unit::TestCase
ary = []
(1..10).each_slice(3) {|a| ary << a}
assert_equal([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]], ary)
+
+ bug9749 = '[ruby-core:62060] [Bug #9749]'
+ ary.clear
+ (1..10).each_slice(3, &lambda {|a, *| ary << a})
+ assert_equal([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]], ary, bug9749)
end
def test_each_cons
ary = []
(1..5).each_cons(3) {|a| ary << a}
assert_equal([[1, 2, 3], [2, 3, 4], [3, 4, 5]], ary)
+
+ bug9749 = '[ruby-core:62060] [Bug #9749]'
+ ary.clear
+ (1..5).each_cons(3, &lambda {|a, *| ary << a})
+ assert_equal([[1, 2, 3], [2, 3, 4], [3, 4, 5]], ary, bug9749)
end
def test_zip