diff options
-rw-r--r-- | class.c | 1 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 8 |
2 files changed, 8 insertions, 1 deletions
@@ -852,7 +852,6 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int (*func) (ID, lo for (; mod; mod = RCLASS_SUPER(mod)) { st_foreach(RCLASS_M_TBL(mod), method_entry, (st_data_t)list); if (BUILTIN_TYPE(mod) == T_ICLASS) continue; - if (FL_TEST(mod, FL_SINGLETON)) continue; if (!recur) break; } ary = rb_ary_new(); diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index f90543196b..453d850bb4 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -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)) |