diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-09 09:05:18 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-09 09:05:18 +0000 |
commit | 7adb8681f015fd958288edd9c5d78484764ec34a (patch) | |
tree | ae6f00953f725b9e004d48adbdfd49e13873a30e /test/ruby/test_proc.rb | |
parent | a563f713984b84305d92b99c547a7e48c33ea2f7 (diff) |
merge revision(s) 23257:
* eval.c (proc_invoke): shares dmethod scope local variables.
a patch from coderrr at [ruby-core:23050]
* gc.c (obj_free): do not free cloned scope local variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@23997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_proc.rb')
-rw-r--r-- | test/ruby/test_proc.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 0ddc76a804..5436879041 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -91,4 +91,14 @@ class TestProc < Test::Unit::TestCase assert_equal(10, Proc.new{|&b| b.call(10)}.call {|x| x}) assert_equal(12, Proc.new{|a,&b| b.call(a)}.call(12) {|x| x}) end + + def test_define_method_scope + a = 1 + c = Class.new + c.send(:define_method, :x) do |*| + lambda {a = 2}.call + end + c.new.x(nil) + assert_equal(2, a, '[ruby-core:23050]') + end end |