summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-01-14 17:48:57 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2025-01-14 17:48:57 -0800
commit8506fdfb4aca5262940b9c49827c2a839f6bb1fe (patch)
treea37f6b2c02d66c5efa7decc714cb56a497c7c1ed /test/ruby
parentf19831a15d680fd995ceaecad1157282be7182dc (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.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 4722fa22e0..29b71bc027 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)