summaryrefslogtreecommitdiff
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authorAlan Wu <[email protected]>2021-02-12 22:45:08 -0500
committerAlan Wu <[email protected]>2021-02-22 17:57:47 -0500
commit58e82206057f2a1644b69ac3631016009ae48590 (patch)
treedfdac1c82428efd916d9cfdbdd2808476b291b4b /test/ruby/test_module.rb
parent67d2619463061beafe86a773310962365380577f (diff)
Check for cyclic prepend before making origin
It's important to only make the origin when the prepend goes through, as the precense of the origin informs whether to do an origin backfill. This plus 2d877327e fix [Bug #17590].
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4181
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 0a5597fd6c..e5152b1012 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -485,6 +485,19 @@ class TestModule < Test::Unit::TestCase
assert_equal([m], m.ancestors)
end
+ def test_bug17590
+ m = Module.new
+ c = Class.new
+ c.prepend(m)
+ c.include(m)
+ m.prepend(m) rescue nil
+ m2 = Module.new
+ m2.prepend(m)
+ c.include(m2)
+
+ assert_equal([m, c, m2] + Object.ancestors, c.ancestors)
+ end
+
def test_prepend_works_with_duped_classes
m = Module.new
a = Class.new do