mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 12:33:56 +02:00
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].
This commit is contained in:
parent
67d2619463
commit
58e8220605
Notes:
git
2021-02-23 07:58:18 +09:00
2 changed files with 48 additions and 21 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue