summaryrefslogtreecommitdiff
path: root/tests/test_markup.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-16 15:22:48 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-16 21:23:01 +0900
commit6748a6de2f5117cbaf4a80bc0ad5f320217397f9 (patch)
tree7bb375d53e77b67a1143c4521cd29f3f38eaa093 /tests/test_markup.py
parent392f775cd1dc18faff83908b14ca222e9d2c3ff7 (diff)
downloadsphinx-git-6748a6de2f5117cbaf4a80bc0ad5f320217397f9.tar.gz
Add testcase for download role
Diffstat (limited to 'tests/test_markup.py')
-rw-r--r--tests/test_markup.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_markup.py b/tests/test_markup.py
index 19928158e..cf503cd14 100644
--- a/tests/test_markup.py
+++ b/tests/test_markup.py
@@ -326,6 +326,26 @@ def test_samp_role(parse):
assert_node(doctree[0], [nodes.paragraph, nodes.literal, "code sample"])
+def test_download_role(parse):
+ # implicit
+ text = ':download:`sphinx.rst`'
+ doctree = parse(text)
+ assert_node(doctree[0], [nodes.paragraph, addnodes.download_reference,
+ nodes.literal, "sphinx.rst"])
+ assert_node(doctree[0][0], refdoc='dummy', refdomain='', reftype='download',
+ refexplicit=False, reftarget='sphinx.rst', refwarn=False)
+ assert_node(doctree[0][0][0], classes=['xref', 'download'])
+
+ # explicit
+ text = ':download:`reftitle <sphinx.rst>`'
+ doctree = parse(text)
+ assert_node(doctree[0], [nodes.paragraph, addnodes.download_reference,
+ nodes.literal, "reftitle"])
+ assert_node(doctree[0][0], refdoc='dummy', refdomain='', reftype='download',
+ refexplicit=True, reftarget='sphinx.rst', refwarn=False)
+ assert_node(doctree[0][0][0], classes=['xref', 'download'])
+
+
@pytest.mark.sphinx('dummy', testroot='prolog')
def test_rst_prolog(app, status, warning):
app.builder.build_all()