summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-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 c88f3c88fe..960c4270d1 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -886,4 +886,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