mirror of
https://github.com/ruby/ruby.git
synced 2025-09-24 04:54:01 +02:00
instance_methods should not special-case singleton classes, fixes #2993
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a5d4d29e2
commit
d894e1d930
2 changed files with 8 additions and 1 deletions
|
@ -141,6 +141,11 @@ class TestModule < Test::Unit::TestCase
|
|||
:bClass3
|
||||
end
|
||||
end
|
||||
|
||||
class CClass < BClass
|
||||
def self.cClass
|
||||
end
|
||||
end
|
||||
|
||||
MyClass = AClass.clone
|
||||
class MyClass
|
||||
|
@ -281,6 +286,9 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_equal([:user, :mixin].sort, User.instance_methods(true).sort)
|
||||
assert_equal([:mixin], Mixin.instance_methods)
|
||||
assert_equal([:mixin], Mixin.instance_methods(true))
|
||||
assert_equal([:cClass], (class << CClass; self; end).instance_methods(false))
|
||||
assert_equal([], (class << BClass; self; end).instance_methods(false))
|
||||
assert_equal([:cm2], (class << AClass; self; end).instance_methods(false))
|
||||
# Ruby 1.8 feature change:
|
||||
# #instance_methods includes protected methods.
|
||||
#assert_equal([:aClass], AClass.instance_methods(false))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue