Skip to content

Commit 0838682

Browse files
authored
Add tests for :manpage: inside a title (#11705)
1 parent b587eb2 commit 0838682

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
* :manpage:`man(1)`
2-
* :manpage:`ls.1`
3-
* :manpage:`sphinx`
4-
* :manpage:`mailx(1) <bsd-mailx/mailx.1>`
5-
* :manpage:`!man(1)`
1+
The :manpage:`cp(1)`
2+
--------------------
3+
* :manpage:`man(1)`
4+
* :manpage:`ls.1`
5+
* :manpage:`sphinx`
6+
* :manpage:`mailx(1) <bsd-mailx/mailx.1>`
7+
* :manpage:`!man(1)`

tests/test_builders/test_build_html.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,20 @@ def test_html_sidebar(app, status, warning):
293293
assert ctx['sidebars'] == []
294294

295295

296+
@pytest.mark.parametrize(("fname", "expect"), [
297+
('index.html', (".//h1/em/a[@href='https://example.com/cp.1']", '', True)),
298+
('index.html', (".//em/a[@href='https://example.com/man.1']", '', True)),
299+
('index.html', (".//em/a[@href='https://example.com/ls.1']", '', True)),
300+
('index.html', (".//em/a[@href='https://example.com/sphinx.']", '', True)),
301+
])
302+
@pytest.mark.sphinx('html', testroot='manpage_url', confoverrides={
303+
'manpages_url': 'https://example.com/{page}.{section}'})
304+
@pytest.mark.test_params(shared_result='test_build_html_manpage_url')
305+
def test_html_manpage(app, cached_etree_parse, fname, expect):
306+
app.build()
307+
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
308+
309+
296310
@pytest.mark.sphinx('html', testroot='toctree-glob',
297311
confoverrides={'html_baseurl': 'https://example.com/'})
298312
def test_html_baseurl(app, status, warning):

0 commit comments

Comments
 (0)