diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-13 15:18:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-13 15:18:12 +0000 |
commit | b7c2f5bc932251744af7a1b3e2a31052589bf0dc (patch) | |
tree | fed8815e4858674a09c6af87cac06bb7a1abaa34 /test/ruby/test_method.rb | |
parent | 537f327653dc314e67fb32996f585f51eaaaea75 (diff) | |
download | ruby-b7c2f5bc932251744af7a1b3e2a31052589bf0dc.tar.gz |
proc.c: fix inherited owner
* proc.c (mnew_from_me): achieve the original defined_class from
prepended iclass, to fix inherited owner.
* proc.c (method_owner): return the defined class, but not the
class which the method object is created from.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index a81d6d3812..45268ed779 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -180,6 +180,15 @@ class TestMethod < Test::Unit::TestCase assert_equal(Array.instance_method(:map).hash, Array.instance_method(:collect).hash) end + def test_owner + c = Class.new do + def foo; end + end + assert_equal(c, c.instance_method(:foo).owner) + c2 = Class.new(c) + assert_equal(c, c2.instance_method(:foo).owner) + end + def test_receiver_name_owner o = Object.new def o.foo; end |