diff options
| author | nagachika <nagachika@ruby-lang.org> | 2024-11-30 14:29:18 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-11-30 14:29:18 +0900 |
| commit | bb065f08441aab8f97b45bd3f1600202547c9532 (patch) | |
| tree | b3245ce5d4c0607a97105490c9ed4e36434bb5cb /test/ruby | |
| parent | 1fc0895971812d5287b23d8cbb00529e425041c0 (diff) | |
merge revision(s) 3b7892b6e4d1a1a5d6019987f9b46ed443dd104f: [Backport #20871]
Fix a bug in rb_include_module that stops nested inclusion into module subclasses
This bug was present since the code was originally added by me
in 3556a834a2847e52162d1d3302d4c64390df1694.
Fixes [Bug #20871]
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_module.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 6129f0cbbe..24785affa0 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -784,6 +784,18 @@ class TestModule < Test::Unit::TestCase assert_equal([:m1, :m0, :m, :sc, :m1, :m0, :c], sc.new.m) end + def test_include_into_module_after_prepend_bug_20871 + bar = Module.new{def bar; 'bar'; end} + foo = Module.new{def foo; 'foo'; end} + m = Module.new + c = Class.new{include m} + m.prepend bar + Class.new{include m} + m.include foo + assert_include c.ancestors, foo + assert_equal "foo", c.new.foo + end + def test_protected_include_into_included_module m1 = Module.new do def other_foo(other) |
