зеркало из https://github.com/github/ruby.git
[ruby/rdoc] Support addition Object class when adding methods to top level
https://github.com/ruby/rdoc/commit/23747b4950
This commit is contained in:
Родитель
2e50989ad3
Коммит
6ff9fcdfa8
|
@ -63,7 +63,7 @@ class TestRDocClassModule < XrefTestCase
|
|||
end
|
||||
|
||||
def test_ancestors
|
||||
assert_equal [@parent, "Object"], @child.ancestors
|
||||
assert_equal [@parent, @object, "BasicObject"], @child.ancestors
|
||||
end
|
||||
|
||||
def test_comment_equals
|
||||
|
@ -129,7 +129,7 @@ class TestRDocClassModule < XrefTestCase
|
|||
end
|
||||
|
||||
def test_each_ancestor
|
||||
assert_equal [@parent], @child.each_ancestor.to_a
|
||||
assert_equal [@parent, @object], @child.each_ancestor.to_a
|
||||
end
|
||||
|
||||
def test_each_ancestor_cycle
|
||||
|
|
|
@ -125,7 +125,7 @@ class TestRDocContext < XrefTestCase
|
|||
|
||||
basic = @c1.find_module_named 'BasicObject'
|
||||
|
||||
assert_equal 'Object', basic.superclass
|
||||
assert_equal @object, basic.superclass
|
||||
end
|
||||
|
||||
def test_add_class_object
|
||||
|
|
|
@ -43,7 +43,7 @@ class TestRDocExtend < XrefTestCase
|
|||
m1_m2_k0.add_extend e0_m3
|
||||
|
||||
assert_equal [e0_m4, e0_m5, e0_m6, e0_m1, e0_m2, e0_m3], m1_m2_k0.extends
|
||||
assert_equal ['Object'], m1_m2_k0.ancestors
|
||||
assert_equal [@object, 'BasicObject'], m1_m2_k0.ancestors
|
||||
|
||||
m1_k1 = m1.add_class RDoc::NormalClass, 'Klass1'
|
||||
|
||||
|
@ -60,7 +60,7 @@ class TestRDocExtend < XrefTestCase
|
|||
m1_k1.add_extend e1_k0_m4
|
||||
|
||||
assert_equal [e1_m1, e1_m2, e1_m3, e1_m4, e1_k0_m4], m1_k1.extends
|
||||
assert_equal ['Object'], m1_k1.ancestors
|
||||
assert_equal [@object, 'BasicObject'], m1_k1.ancestors
|
||||
|
||||
m1_k2 = m1.add_class RDoc::NormalClass, 'Klass2'
|
||||
|
||||
|
@ -75,7 +75,7 @@ class TestRDocExtend < XrefTestCase
|
|||
m1_k2.add_extend e2_k0_m4
|
||||
|
||||
assert_equal [e2_m1, e2_m3, e2_m2, e2_k0_m4], m1_k2.extends
|
||||
assert_equal ['Object'], m1_k2.ancestors
|
||||
assert_equal [@object, 'BasicObject'], m1_k2.ancestors
|
||||
|
||||
m1_k3 = m1.add_class RDoc::NormalClass, 'Klass3'
|
||||
|
||||
|
@ -88,7 +88,7 @@ class TestRDocExtend < XrefTestCase
|
|||
m1_k3.add_extend e3_m4
|
||||
|
||||
assert_equal [e3_m1, e3_m2, e3_m4], m1_k3.extends
|
||||
assert_equal ['Object'], m1_k3.ancestors
|
||||
assert_equal [@object, 'BasicObject'], m1_k3.ancestors
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestRDocInclude < XrefTestCase
|
|||
|
||||
assert_equal [i0_m4, i0_m5, i0_m6, i0_m1, i0_m2, i0_m3], m1_m2_k0.includes
|
||||
assert_equal [m1_m2_m3, m1_m2, m1, m1_m2_k0_m4_m6, m1_m2_k0_m5,
|
||||
m1_m2_k0_m4, 'Object'], m1_m2_k0.ancestors
|
||||
m1_m2_k0_m4, @object, 'BasicObject'], m1_m2_k0.ancestors
|
||||
|
||||
m1_k1 = m1.add_class RDoc::NormalClass, 'Klass1'
|
||||
|
||||
|
@ -63,8 +63,8 @@ class TestRDocInclude < XrefTestCase
|
|||
m1_k1.add_include i1_k0_m4
|
||||
|
||||
assert_equal [i1_m1, i1_m2, i1_m3, i1_m4, i1_k0_m4], m1_k1.includes
|
||||
assert_equal [m1_m2_k0_m4, m1_m2_m3_m4, m1_m2_m3, m1_m2, m1, 'Object'],
|
||||
m1_k1.ancestors
|
||||
assert_equal [m1_m2_k0_m4, m1_m2_m3_m4, m1_m2_m3, m1_m2, m1, @object,
|
||||
'BasicObject'], m1_k1.ancestors
|
||||
|
||||
m1_k2 = m1.add_class RDoc::NormalClass, 'Klass2'
|
||||
|
||||
|
@ -79,7 +79,8 @@ class TestRDocInclude < XrefTestCase
|
|||
m1_k2.add_include i2_k0_m4
|
||||
|
||||
assert_equal [i2_m1, i2_m3, i2_m2, i2_k0_m4], m1_k2.includes
|
||||
assert_equal [m1_m2_k0_m4, m1_m2, m1_m3, m1, 'Object'], m1_k2.ancestors
|
||||
assert_equal [m1_m2_k0_m4, m1_m2, m1_m3, m1, @object, 'BasicObject'],
|
||||
m1_k2.ancestors
|
||||
|
||||
m1_k3 = m1.add_class RDoc::NormalClass, 'Klass3'
|
||||
|
||||
|
@ -92,7 +93,7 @@ class TestRDocInclude < XrefTestCase
|
|||
m1_k3.add_include i3_m4
|
||||
|
||||
assert_equal [i3_m1, i3_m2, i3_m4], m1_k3.includes
|
||||
assert_equal [m1_m2_m4, m1_m2, m1, 'Object'], m1_k3.ancestors
|
||||
assert_equal [m1_m2_m4, m1_m2, m1, @object, 'BasicObject'], m1_k3.ancestors
|
||||
end
|
||||
|
||||
def test_store_equals
|
||||
|
|
|
@ -11,7 +11,7 @@ class TestRDocNormalClass < XrefTestCase
|
|||
sub_klass.superclass = klass
|
||||
sub_klass.add_include incl
|
||||
|
||||
assert_equal [incl.name, klass, 'Object'], sub_klass.ancestors
|
||||
assert_equal [incl.name, klass, @object, 'BasicObject'], sub_klass.ancestors
|
||||
end
|
||||
|
||||
def test_ancestors_multilevel
|
||||
|
@ -19,7 +19,7 @@ class TestRDocNormalClass < XrefTestCase
|
|||
c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1.full_name
|
||||
c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2.full_name
|
||||
|
||||
assert_equal [c2, c1, 'Object'], c3.ancestors
|
||||
assert_equal [c2, c1, @object, 'BasicObject'], c3.ancestors
|
||||
end
|
||||
|
||||
def test_aref
|
||||
|
|
|
@ -161,9 +161,10 @@ class TestRDocStore < XrefTestCase
|
|||
|
||||
def test_all_classes_and_modules
|
||||
expected = %w[
|
||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 C9 C9::A C9::B
|
||||
C1 C10 C10::C11 C11 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 C9 C9::A C9::B
|
||||
Child
|
||||
M1 M1::M2
|
||||
Object
|
||||
Parent
|
||||
]
|
||||
|
||||
|
@ -212,8 +213,9 @@ class TestRDocStore < XrefTestCase
|
|||
|
||||
def test_classes
|
||||
expected = %w[
|
||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 C9 C9::A C9::B
|
||||
C1 C10 C10::C11 C11 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 C9 C9::A C9::B
|
||||
Child
|
||||
Object
|
||||
Parent
|
||||
]
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class TestRDocTopLevel < XrefTestCase
|
|||
@top_level.add_method method
|
||||
|
||||
object = @store.find_class_named 'Object'
|
||||
assert_equal [method], object.method_list
|
||||
assert_equal [@c10_method, @c11_method, method], object.method_list
|
||||
assert_includes object.in_files, @top_level
|
||||
end
|
||||
|
||||
|
@ -101,7 +101,7 @@ class TestRDocTopLevel < XrefTestCase
|
|||
@top_level.add_method method
|
||||
|
||||
object = @store.find_class_named('Object')
|
||||
assert_empty object.method_list
|
||||
assert_equal [@c10_method, @c11_method], object.method_list
|
||||
assert_includes object.in_files, @top_level
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче