about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-11-19 18:09:22 +0100
committerbptato <nincsnevem662@gmail.com>2023-11-19 18:10:38 +0100
commit894aaa0be519eb81004715e5d0d9fbb17756216f (patch)
treeb7841839cd636f2796dc51511ba14d3735dbdf70
parent4cd0ce53d14ad2c4ed795d6cb86920eb6a279f8f (diff)
downloadchawan-894aaa0be519eb81004715e5d0d9fbb17756216f.tar.gz
tests/tree: add tests2, tests3
-rw-r--r--tests/tree.nim12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/tree.nim b/tests/tree.nim
index 700b412c..c88b3bec 100644
--- a/tests/tree.nim
+++ b/tests/tree.nim
@@ -137,7 +137,7 @@ proc parseTestDocument(ctx: var TCTestParser): Document =
         thistext.data &= line.substr(0, line.high - 1)
         thistext = nil
       else:
-        thistext.data &= line
+        thistext.data &= line & "\n"
       continue
     assert line[0] == '|' and line[1] == ' '
     while indent >= line.len or not line.startsWith('|' & ' '.repeat(indent)):
@@ -168,8 +168,8 @@ proc parseTestDocument(ctx: var TCTestParser): Document =
     elif str[0] == '"':
       let text = Text(nodeType: TEXT_NODE)
       top.childList.add(text)
-      if str[^1] != '"':
-        text.data = str.substr(1)
+      if str[^1] != '"' or str.len == 1:
+        text.data = str.substr(1) & "\n"
         thistext = text
       else:
         text.data = str.substr(1, str.high - 1)
@@ -263,3 +263,9 @@ proc runTests(filename: string) =
 
 test "tests1.dat":
   runTests("tests1.dat")
+
+test "tests2.dat":
+  runTests("tests2.dat")
+
+test "tests3.dat":
+  runTests("tests3.dat")