summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-19 18:43:01 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-19 18:43:01 +0000
commit9eb78a21387b6a90f5f9558de79b59f6348156fc (patch)
tree3b590f414023bcb1d4a4dc8b394bb3435fc115c1 /test
parent3f1fc07e0533b1c27817828843513964f1b8b67d (diff)
merge revision(s) 49922,50111,50112: [Backport #11012]
* proc.c: use RUBY_VM_IFUNC_P() to recognize IFUNC or not. * vm.c: ditto. * vm_dump.c: ditto. * vm_insnhelper.c: ditto. * vm_core.h: use RB_TYPE_P() instead of BUILTIN_TYPE(). * proc.c (proc_binding): replicate env from method object, and allocate the local variable area for the iseq local table. [ruby-core:68673] [Bug #11012] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index c8b5ff12d3..35ddc87bcc 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -877,4 +877,18 @@ class TestMethod < Test::Unit::TestCase
obj.bar
end
end
+
+ def test_to_proc_binding
+ bug11012 = '[ruby-core:68673] [Bug #11012]'
+ class << (obj = Object.new)
+ src = 1000.times.map {|i|"v#{i} = nil"}.join("\n")
+ eval("def foo()\n""#{src}\n""end")
+ end
+
+ b = obj.method(:foo).to_proc.binding
+ b.local_variables.each_with_index {|n, i|
+ b.local_variable_set(n, i)
+ }
+ assert_equal([998, 999], %w[v998 v999].map {|n| b.local_variable_get(n)}, bug11012)
+ end
end