summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_ri_driver.rb
diff options
context:
space:
mode:
authorUlysse Buonomo <[email protected]>2021-06-27 00:33:34 +0200
committerNobuyoshi Nakada <[email protected]>2021-07-05 11:34:25 +0900
commitec9a9af3754671cd066eb9827c4207b36a5f9dba (patch)
tree4dfc6eadde3439a50674e801b355d1866a778699 /test/rdoc/test_rdoc_ri_driver.rb
parentc7d1989986becc0e403afc35ad4caa5806e787be (diff)
[ruby/rdoc] Fix chained inclusion ancestors_of
Fixes #814 Signed-off-by: Ulysse Buonomo <[email protected]> https://github.com/ruby/rdoc/commit/b45f747216
Diffstat (limited to 'test/rdoc/test_rdoc_ri_driver.rb')
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index f79d17b1cd..87e4ebd2b1 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -421,6 +421,30 @@ class TestRDocRIDriver < RDoc::TestCase
assert_equal %w[X Mixin Object Foo], @driver.ancestors_of('Foo::Bar')
end
+ def test_ancestors_of_chained_inclusion
+ # Store represents something like:
+ #
+ # module X
+ # end
+ #
+ # module Y
+ # include X
+ # end
+ #
+ # class Z
+ # include Y
+ # end
+ #
+ # Y is not chosen randomly, it has to be after Object in the alphabet
+ # to reproduce https://github.com/ruby/rdoc/issues/814.
+ store = RDoc::RI::Store.new @home_ri
+ store.cache[:ancestors] = { "Z" => ["Object", "Y"], "Y" => ["X"] }
+ store.cache[:modules] = %W[X Y Z]
+ @driver.stores = [store]
+
+ assert_equal %w[X Y Object], @driver.ancestors_of('Z')
+ end
+
def test_classes
util_multi_store