summary refs log tree commit diff stats
path: root/tests/stdlib/trst.nim
diff options
context:
space:
mode:
authorAndrey Makarov <ph.makarov@gmail.com>2021-06-26 19:10:46 +0300
committerGitHub <noreply@github.com>2021-06-26 18:10:46 +0200
commit1b9b8060075efab82912dc33ba64e671d102b999 (patch)
treecb608477f1c307b3754d273b381b9edaf048d55f /tests/stdlib/trst.nim
parentb8f761b7e2cb3f28abd6486d28ea19228887cdf5 (diff)
downloadNim-1b9b8060075efab82912dc33ba64e671d102b999.tar.gz
rst: fix bug 20 from #17340 (#18360)
and a leftover bug: priority of option list inside definition list
Diffstat (limited to 'tests/stdlib/trst.nim')
-rw-r--r--tests/stdlib/trst.nim47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/stdlib/trst.nim b/tests/stdlib/trst.nim
index d53092d3b..fb9552479 100644
--- a/tests/stdlib/trst.nim
+++ b/tests/stdlib/trst.nim
@@ -83,6 +83,53 @@ suite "RST parsing":
               rnLeaf  'set'
         """)
 
+  test "items of 1 option list can be separated by blank lines":
+    check(dedent"""
+        -a  desc1
+
+        -b  desc2
+        """.toAst ==
+      dedent"""
+        rnOptionList
+          rnOptionListItem  order=1
+            rnOptionGroup
+              rnLeaf  '-'
+              rnLeaf  'a'
+            rnDescription
+              rnLeaf  'desc1'
+          rnOptionListItem  order=2
+            rnOptionGroup
+              rnLeaf  '-'
+              rnLeaf  'b'
+            rnDescription
+              rnLeaf  'desc2'
+      """)
+
+  test "option list has priority over definition list":
+    check(dedent"""
+        defName
+            defBody
+
+        -b  desc2
+        """.toAst ==
+      dedent"""
+        rnInner
+          rnDefList
+            rnDefItem
+              rnDefName
+                rnLeaf  'defName'
+              rnDefBody
+                rnInner
+                  rnLeaf  'defBody'
+          rnOptionList
+            rnOptionListItem  order=1
+              rnOptionGroup
+                rnLeaf  '-'
+                rnLeaf  'b'
+              rnDescription
+                rnLeaf  'desc2'
+      """)
+
   test "RST comment":
     check(dedent"""
         .. comment1