diff options
author | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-10 18:31:58 +0000 |
---|---|---|
committer | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-10 18:31:58 +0000 |
commit | 919887813900fa61026f072a5cbcfd7ad873ea97 (patch) | |
tree | 9eab32003eccefe34fd9a27b0050e7e616ea9580 /test/ruby | |
parent | 665787ea4e0cef0157d6f4a6bca65973ce8839be (diff) |
Fix method scoping bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@24030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_proc.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index f0b78ffb23..1fe8446b67 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -86,4 +86,15 @@ class TestProc < Test::Unit::TestCase b = lambda {} assert_not_equal(a, b) 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 |