diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-13 09:38:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-13 09:38:49 +0000 |
commit | 4b7514527870f3e7268846ee9fb275301f57b30a (patch) | |
tree | 652d86baec39246b717b690df4725b8f67ed42f3 /test/ruby/test_method.rb | |
parent | aae1d28b6f33d1237e576317497d22158114f103 (diff) |
proc.c: skip prepends
* proc.c (mnew): skip prepending modules and return the method bound
on the given class. [ruby-core:52160] [Bug #7836]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index ad68357ddf..59034eb83a 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -534,4 +534,31 @@ class TestMethod < Test::Unit::TestCase assert_equal(x.singleton_class, x.method(:bar).owner) assert(x.method(:foo) != x.method(:bar), bug7613) end + + def test_included + m = Module.new { + def foo + end + } + c = Class.new { + def foo + end + include m + } + assert_equal(c, c.instance_method(:foo).owner) + end + + def test_prepended + bug7836 = '[ruby-core:52160] [Bug #7836]' + m = Module.new { + def foo + end + } + c = Class.new { + def foo + end + prepend m + } + assert_equal(c, c.instance_method(:foo).owner, bug7836) + end end |