diff options
author | Jeremy Evans <[email protected]> | 2020-06-03 12:14:49 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2020-06-18 08:18:31 -0700 |
commit | 41582d5866ae34c57094f70f95c3d31f4a1fa4ff (patch) | |
tree | 2de16cd0f2bcdd4172f67ba4ae5f65c7541fe9e2 /test/ruby/test_module.rb | |
parent | 750203c514e0e9a49f7d53fb54084e6844fca42a (diff) |
Make Module#prepend affect the iclasses of the module
3556a834a2847e52162d1d3302d4c64390df1694 added support for
Module#include to affect the iclasses of the module. It didn't add
support for Module#prepend because there were bugs in the object model
and GC at the time that prevented it. Those problems have been
addressed in ad729a1d11c6c57efd2e92803b4e937db0f75252 and
98286e9850936e27e8ae5e4f20858cc9c13d2dde, and now adding support for
it is straightforward and does not break any tests or specs.
Fixes [Bug #9573]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3181
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index d3012e59ae..d2da384cbd 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -587,6 +587,28 @@ class TestModule < Test::Unit::TestCase m1.include m2 m1.include m3 assert_equal([:m1, :sc, :m2, :m3, :c], o.foo) + + m1, m2, m3, sc, o = modules.call + assert_equal([:sc, :c], o.foo) + sc.prepend m1 + assert_equal([:m1, :sc, :c], o.foo) + m1.prepend m2 + assert_equal([:m2, :m1, :sc, :c], o.foo) + m2.prepend m3 + assert_equal([:m3, :m2, :m1, :sc, :c], o.foo) + m1, m2, m3, sc, o = modules.call + sc.include m1 + assert_equal([:sc, :m1, :c], o.foo) + sc.prepend m2 + assert_equal([:m2, :sc, :m1, :c], o.foo) + sc.prepend m3 + assert_equal([:m3, :m2, :sc, :m1, :c], o.foo) + m1, m2, m3, sc, o = modules.call + sc.include m1 + assert_equal([:sc, :m1, :c], o.foo) + m2.prepend m3 + m1.include m2 + assert_equal([:sc, :m1, :m3, :m2, :c], o.foo) end def test_included_modules |