diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-29 02:51:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-29 02:51:34 +0000 |
commit | 509089e9b1c094cb048e7f66643c853f86a91f4f (patch) | |
tree | d23bf882b70e635971548149dd09bf4c91cdbfde /test/ruby/test_method.rb | |
parent | 4bc9b1d29aa50d22b214593512772d2236e3169c (diff) | |
download | ruby-509089e9b1c094cb048e7f66643c853f86a91f4f.tar.gz |
proc.c: replicate method env
* 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/trunk@50111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 14 |
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 |