aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-07 17:54:49 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-07 17:54:49 +0000
commitdfde34cb3c968f3238afcfd05298bc6b88585bcb (patch)
tree634eea6b870bfb289dd47c3b2ab087353218ed16 /test/ruby/test_module.rb
parent221f2a1d8a7c42165b3144fbf22b9585e3026e18 (diff)
downloadruby-dfde34cb3c968f3238afcfd05298bc6b88585bcb.tar.gz
* class.c (rb_mod_ancestors): Include singleton_class in ancestors list
[Feature #8035] * test/ruby/test_module.rb (class): test for above * test/ruby/marshaltestlib.rb (module): adapt test * NEWS: list change git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 5450c8ff3a..af3150b8a0 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1663,6 +1663,20 @@ class TestModule < Test::Unit::TestCase
end
end
+ def test_singleton_class_ancestors
+ feature8035 = '[ruby-core:53171]'
+ obj = Object.new
+ assert_equal [obj.singleton_class, Object], obj.singleton_class.ancestors.first(2), feature8035
+
+ mod = Module.new
+ obj.extend mod
+ assert_equal [obj.singleton_class, mod, Object], obj.singleton_class.ancestors.first(3)
+
+ obj = Object.new
+ obj.singleton_class.send :prepend, mod
+ assert_equal [mod, obj.singleton_class, Object], obj.singleton_class.ancestors.first(3)
+ end
+
private
def assert_top_method_is_private(method)