mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add testcase for modindex_common_prefix
This commit is contained in:
parent
8cfea7bedd
commit
0465c1a7ad
@ -626,3 +626,26 @@ def test_module_index_not_collapsed(app):
|
||||
('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', '')])],
|
||||
True
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(freshenv=True, confoverrides={'modindex_common_prefix': ['sphinx.']})
|
||||
def test_modindex_common_prefix(app):
|
||||
text = (".. py:module:: docutils\n"
|
||||
".. py:module:: sphinx\n"
|
||||
".. py:module:: sphinx.config\n"
|
||||
".. py:module:: sphinx.builders\n"
|
||||
".. py:module:: sphinx.builders.html\n"
|
||||
".. py:module:: sphinx_intl\n")
|
||||
restructuredtext.parse(app, text)
|
||||
index = PythonModuleIndex(app.env.get_domain('py'))
|
||||
assert index.generate() == (
|
||||
[('b', [IndexEntry('sphinx.builders', 1, 'index', 'module-sphinx.builders', '', '', ''), # NOQA
|
||||
IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', '')]), # NOQA
|
||||
('c', [IndexEntry('sphinx.config', 0, 'index', 'module-sphinx.config', '', '', '')]),
|
||||
('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]),
|
||||
('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', ''),
|
||||
IndexEntry('sphinx_intl', 0, 'index', 'module-sphinx_intl', '', '', '')])],
|
||||
True
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user