diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-09-19 22:22:09 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-09-20 15:23:00 +0900 |
commit | 2e3d43e5775799d1b4d6672a3a18b3fc5777c52b (patch) | |
tree | 1466984fcc6ec92eda4abad9579f045f9ad62a92 /test/ruby/test_module.rb | |
parent | d2d549032c7e40d3720f298a67abbcdc5b1666a2 (diff) |
Allow to include uninitialized modules [Bug #18177]
The module that is about to be included is considered initialized.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4868
Diffstat (limited to 'test/ruby/test_module.rb')
-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 b36b8b7810..385d8dddfe 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -432,6 +432,18 @@ class TestModule < Test::Unit::TestCase initialize_copy(Module.new) end end + + m = Class.new(Module) do + def initialize_copy(other) + # leave uninitialized + end + end.new.dup + c = Class.new + assert_operator(c.include(m), :<, m) + cp = Module.instance_method(:initialize_copy) + assert_raise(TypeError) do + cp.bind_call(m, Module.new) + end end def test_dup |