diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2024-11-19 13:58:19 -0800 |
|---|---|---|
| committer | Jeremy Evans <code@jeremyevans.net> | 2024-11-20 07:59:31 -0800 |
| commit | 3b7892b6e4d1a1a5d6019987f9b46ed443dd104f (patch) | |
| tree | 66717b779afca265fa1cbe77262f85d5d595bef3 /test/ruby | |
| parent | 9db056f2ea2c1a9f9887a3436b212f52c3ad3b8d (diff) | |
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]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12125
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 3228bb5c61..73d33d8602 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) |
