diff options
author | Hiroshi SHIBATA <[email protected]> | 2024-12-03 09:03:17 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-12-03 10:59:32 +0900 |
commit | d85e8b53393779f7cc7aa5779387fc68ac85dc47 (patch) | |
tree | 1a6bb1b716cff14f434ab6eae92cc7b07b208d8a /test | |
parent | 59d23174c01d201b4a1bbc0eaab32b167a3cb975 (diff) |
Reapply "[ruby/rdoc] fix: C variables should never show up in Ancestors tree"
This reverts commit 0fe82ae087130d7f360cc0607be93995cedbdb16.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12233
Diffstat (limited to 'test')
-rw-r--r-- | test/rdoc/test_rdoc_store.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb index 50e8667d81..2665f163e4 100644 --- a/test/rdoc/test_rdoc_store.rb +++ b/test/rdoc/test_rdoc_store.rb @@ -281,6 +281,26 @@ class TestRDocStore < XrefTestCase assert_nil @s.find_c_enclosure('cObject') end + def test_resolve_c_superclasses + # first parse a child that references an unknown parent + c_file1 = @s.add_file 'ext1.c' + c_file1.add_class RDoc::NormalClass, 'Child', 'cExternParent' + + # then parse the parent and register the C variable name as a C enclosure + c_file2 = @s.add_file 'ext2.c' + parent = c_file2.add_class RDoc::NormalClass, 'Parent', 'rb_cObject' + + @s.add_c_enclosure('cExternParent', parent) + + # at this point, the child's superclass is still the name of the C variable + assert_equal("cExternParent", @s.classes_hash['Child'].superclass) + + @s.resolve_c_superclasses + + # now the ancestor tree correctly references the NormalClass objects + assert_equal(parent, @s.classes_hash['Child'].superclass) + end + def test_find_class_named assert_equal @c1, @store.find_class_named('C1') |