diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-16 06:38:52 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-16 06:38:52 +0000 |
commit | f77311678258a99302e6fb8ea2d60bc21f2039b2 (patch) | |
tree | 1e38869108174aa271b1358f0ef44b6a0e9cca89 /test | |
parent | 6319c35c15c452cfe5c050be0a177d82d1351300 (diff) | |
download | ruby-f77311678258a99302e6fb8ea2d60bc21f2039b2.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_proc.rb | 20 |
1 files changed, 20 insertions, 0 deletions
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 |