object.c: fix prepend cmp

* object.c (rb_class_inherited_p): search the corresponding
  ancestor to prepended module from prepending class itself.
  [ruby-core:72493] [Bug #11878]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-30 00:58:58 +00:00
parent d252e224f6
commit a974041b0e
3 changed files with 14 additions and 5 deletions

View file

@ -1566,6 +1566,12 @@ class TestModule < Test::Unit::TestCase
end
end
def test_prepend_CMP
bug11878 = '[ruby-core:72493] [Bug #11878]'
assert_equal(-1, C1 <=> M2)
assert_equal(+1, M2 <=> C1, bug11878)
end
def test_prepend_inheritance
bug6654 = '[ruby-core:45914]'
a = labeled_module("a")