From f77311678258a99302e6fb8ea2d60bc21f2039b2 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 16 Dec 2015 06:38:52 +0000 Subject: * vm.c: fix mark miss for proc given as passed block. [Bug #11750] * vm.c (vm_make_proc_from_block): should return a Proc object if block is given. Previous implementation returns a Proc object only when corresponding Proc object is not available. * vm.c (vm_make_env_each): ditto. * test/ruby/test_proc.rb: add a test for this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_proc.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/ruby/test_proc.rb') diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index fa247f2fc0..b67773b7f8 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1321,4 +1321,24 @@ class TestProc < Test::Unit::TestCase def obj.b; binding; end assert_same(obj, obj.b.receiver, feature8779) end + + def test_proc_mark + assert_normal_exit(<<-'EOS') + def f + Enumerator.new{ + 100000.times {|i| + yield + s = "#{i}" + } + } + end + + def g + x = proc{} + f(&x) + end + e = g + e.each {} + EOS + end end -- cgit v1.2.3