ancestor modules

* class.c (rb_prepend_module): ancestors of prepending module also
  should be included.  [ruby-core:45914][Bug #6654]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-06-27 12:31:17 +00:00
parent 48c04ad0d8
commit cf3a8f09b8
3 changed files with 36 additions and 6 deletions

View file

@ -1271,6 +1271,15 @@ class TestModule < Test::Unit::TestCase
assert_equal(expected, obj.m1)
end
def test_prepend_inheritance
bug6654 = '[ruby-core:45914]'
a = Module.new
b = Module.new {include a}
c = Class.new {prepend b}
assert_operator(c, :<, b, bug6654)
assert_operator(c, :<, a, bug6654)
end
def test_prepend_instance_methods
bug6655 = '[ruby-core:45915]'
assert_equal(Object.instance_methods, Class.new {prepend Module.new}.instance_methods, bug6655)