summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 6bbe168348..c7245ab2db 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -572,6 +572,26 @@ class TestModule < Test::Unit::TestCase
assert_equal(2, a2.b)
end
+ def test_ancestry_of_duped_classes
+ m = Module.new
+ sc = Class.new
+ a = Class.new(sc) do
+ def b; 2 end
+ prepend m
+ end
+
+ a2 = a.dup.new
+
+ assert_kind_of Object, a2
+ assert_kind_of sc, a2
+ refute_kind_of a, a2
+ assert_kind_of m, a2
+
+ assert_kind_of Class, a2.class
+ assert_kind_of sc.singleton_class, a2.class
+ assert_same sc, a2.class.superclass
+ end
+
def test_gc_prepend_chain
assert_separately([], <<-EOS)
10000.times { |i|