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-24 11:28:28 +0300
committerGitHub <noreply@github.com>2021-06-24 10:28:28 +0200
commit0c8d3ae9852721147ddf878e204c14e949ed676a (patch)
tree744fc8f40b44f723ca67bea9a2d70ff4dc78a55a /tests/stdlib/trst.nim
parent55c1953f636ff2d2e2b9e9599194fa6c3fb49050 (diff)
downloadNim-0c8d3ae9852721147ddf878e204c14e949ed676a.tar.gz
rst: allow comment to continue on second line (#18338)
Diffstat (limited to 'tests/stdlib/trst.nim')
-rw-r--r--tests/stdlib/trst.nim66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/stdlib/trst.nim b/tests/stdlib/trst.nim
index c69450cd9..d53092d3b 100644
--- a/tests/stdlib/trst.nim
+++ b/tests/stdlib/trst.nim
@@ -83,6 +83,72 @@ suite "RST parsing":
               rnLeaf  'set'
         """)
 
+  test "RST comment":
+    check(dedent"""
+        .. comment1
+         comment2
+        someParagraph""".toAst ==
+      dedent"""
+        rnLeaf  'someParagraph'
+        """)
+
+    check(dedent"""
+        ..
+         comment1
+         comment2
+        someParagraph""".toAst ==
+      dedent"""
+        rnLeaf  'someParagraph'
+        """)
+
+  test "check that additional line right after .. ends comment":
+    check(dedent"""
+        ..
+
+         notAcomment1
+         notAcomment2
+        someParagraph""".toAst ==
+      dedent"""
+        rnInner
+          rnBlockQuote
+            rnInner
+              rnLeaf  'notAcomment1'
+              rnLeaf  ' '
+              rnLeaf  'notAcomment2'
+          rnParagraph
+            rnLeaf  'someParagraph'
+        """)
+
+  test "but blank lines after 2nd non-empty line don't end the comment":
+    check(dedent"""
+        ..
+           comment1
+
+
+         comment2
+        someParagraph""".toAst ==
+      dedent"""
+        rnLeaf  'someParagraph'
+        """)
+
+  test "using .. as separator b/w directives and block quotes":
+    check(dedent"""
+        .. note:: someNote
+    
+        ..
+    
+          someBlockQuote""".toAst ==
+      dedent"""
+        rnInner
+          rnAdmonition  adType=note
+            [nil]
+            [nil]
+            rnLeaf  'someNote'
+          rnBlockQuote
+            rnInner
+              rnLeaf  'someBlockQuote'
+        """)
+
 suite "RST indentation":
   test "nested bullet lists":
     let input = dedent """