summaryrefslogtreecommitdiff
path: root/tests/test_domain_std.py
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@inria.fr>2021-01-20 17:57:19 +0100
committerGuillaume Melquiond <guillaume.melquiond@inria.fr>2021-01-23 08:57:36 +0100
commitffacb2ca1827cff1e4a93d6ded228ef25ba5483b (patch)
tree86ba4a7693484a1c2db928b301ac987c7b984ee5 /tests/test_domain_std.py
parent8a1d0d0da6270556bfe336b5a18734c13b12b362 (diff)
downloadsphinx-git-ffacb2ca1827cff1e4a93d6ded228ef25ba5483b.tar.gz
Add testcase.
Diffstat (limited to 'tests/test_domain_std.py')
-rw-r--r--tests/test_domain_std.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_domain_std.py b/tests/test_domain_std.py
index 628b538b7..cf32e7964 100644
--- a/tests/test_domain_std.py
+++ b/tests/test_domain_std.py
@@ -405,6 +405,22 @@ def test_productionlist(app, status, warning):
assert "A</strong> ::= B C D E F G" in text
+def test_productionlist2(app):
+ text = (".. productionlist:: P2\n"
+ " A: `:A` `A`\n"
+ " B: `P1:B` `~P1:B`\n")
+ doctree = restructuredtext.parse(app, text)
+ refnodes = list(doctree.traverse(pending_xref))
+ assert_node(refnodes[0], pending_xref, reftarget="A")
+ assert_node(refnodes[1], pending_xref, reftarget="P2:A")
+ assert_node(refnodes[2], pending_xref, reftarget="P1:B")
+ assert_node(refnodes[3], pending_xref, reftarget="P1:B")
+ assert_node(refnodes[0], [pending_xref, nodes.literal, "A"])
+ assert_node(refnodes[1], [pending_xref, nodes.literal, "A"])
+ assert_node(refnodes[2], [pending_xref, nodes.literal, "P1:B"])
+ assert_node(refnodes[3], [pending_xref, nodes.literal, "B"])
+
+
def test_disabled_docref(app):
text = (":doc:`index`\n"
":doc:`!index`\n")