summaryrefslogtreecommitdiffstats
path: root/rtemsqual/tests/test_content_sphinx.py
diff options
context:
space:
mode:
authorSofia Pacheco <sofia.pacheco@edisoft.pt>2020-05-18 07:13:33 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-05-28 10:38:22 +0200
commit5e6eb37cfdc506e0239019091c758bf2fedbdd8a (patch)
tree6c0ef329a3c9daa4e44f6a7f1e62c4549213e018 /rtemsqual/tests/test_content_sphinx.py
parentitems: Add Item.data (diff)
downloadrtems-central-5e6eb37cfdc506e0239019091c758bf2fedbdd8a.tar.bz2
Added sphinx content utils for section writing
Diffstat (limited to 'rtemsqual/tests/test_content_sphinx.py')
-rw-r--r--rtemsqual/tests/test_content_sphinx.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/rtemsqual/tests/test_content_sphinx.py b/rtemsqual/tests/test_content_sphinx.py
index fa1823d2..997f298e 100644
--- a/rtemsqual/tests/test_content_sphinx.py
+++ b/rtemsqual/tests/test_content_sphinx.py
@@ -38,12 +38,60 @@ def test_add_label():
"""
+def test_directive():
+ sc = SphinxContent()
+ with sc.directive("x"):
+ sc.add("y")
+ assert str(sc) == """.. x::
+ y
+"""
+ with sc.directive("z", "xy", [":a:", ":b:"]):
+ sc.add("c")
+ assert str(sc) == """.. x::
+ y
+
+.. z:: xy
+ :a:
+ :b:
+
+ c
+"""
+
+
def test_add_header():
sc = SphinxContent()
sc.add_header("x")
assert str(sc) == """x
=
"""
+ sc.add_header("yz", 1)
+ assert str(sc) == """x
+=
+
+yz
+**
+"""
+
+
+def test_add_header_with_ref():
+ sc = SphinxContent()
+ sc.add_header_with_ref("x", 1)
+ assert str(sc) == """.. _SectionX:
+
+x
+*
+"""
+ sc.add_header_with_ref("yz w", 2)
+ assert str(sc) == """.. _SectionX:
+
+x
+*
+
+.. _SectionYzW:
+
+yz w
+====
+"""
def test_append():