Add basic syntax test for index :name:

This commit is contained in:
sethg
2020-02-22 14:12:27 +01:00
parent b20d74f8a0
commit 8a5a00d06c

View File

@@ -126,3 +126,14 @@ def test_create_index_by_key(app):
assert index[0] == ('D', [('docutils', [[('main', '#term-docutils')], [], None])])
assert index[1] == ('P', [('Python', [[('main', '#term-python')], [], None])])
assert index[2] == ('', [('スフィンクス', [[('main', '#term-0')], [], ''])])
@pytest.mark.sphinx('dummy', freshenv=True)
def test_create_index_with_name(app):
text = (".. index:: single: docutils\n :name: ref1\n"
".. index:: see: Python; interpreter\n :name: ref2\n")
restructuredtext.parse(app, text)
index = IndexEntries(app.env).create_index(app.builder)
assert len(index) == 2
assert index[0] == ('D', [('docutils', [[('', '#index-0')], [], None])])
assert index[1] == ('P', [('Python', [[], [('see interpreter', [])], None])])