diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-31 15:33:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-31 15:33:23 +0000 |
commit | b283d01987291f92540e60a5887197b0945e3a84 (patch) | |
tree | 33575a8d5c9f4aa4f955a8e8d8a244a27f6d2245 /test | |
parent | bc08bdc013e82df978d72a1f9337fe47f5031e56 (diff) | |
download | ruby-b283d01987291f92540e60a5887197b0945e3a84.tar.gz |
class.c: fix duplication of prepended module
* class.c (include_class_new): fix duplication of prepended module.
since m_tbl of prepended module is always zero, copy from its
copy iclass of original.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_module.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 43e80a5955..4e5f8856a6 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1356,6 +1356,15 @@ class TestModule < Test::Unit::TestCase assert_equal([:m0, :m1, :m2, :c1], c1.new.x) assert_equal([c2, m0, m1, m2, c0], c2.ancestors[0, 5], bug6662) assert_equal([:c2, :m0, :m1, :m2, :c0], c2.new.x) + + m3 = labeled_module("m3") {include m1; prepend m1} + assert_equal([m3, m0, m1], m3.ancestors) + m3 = labeled_module("m3") {prepend m1; include m1} + assert_equal([m0, m1, m3], m3.ancestors) + m3 = labeled_module("m3") {prepend m1; prepend m1} + assert_equal([m0, m1, m3], m3.ancestors) + m3 = labeled_module("m3") {include m1; include m1} + assert_equal([m3, m0, m1], m3.ancestors) end def labeled_module(name, &block) |