summary refs log tree commit diff stats
path: root/testament
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-04-20 16:30:17 +0200
committerGitHub <noreply@github.com>2021-04-20 16:30:17 +0200
commit0b116310bfb691755481293e8f9af11190fe0999 (patch)
tree2eeff75d1a1cabd5794f4eb147e982e8e3974dac /testament
parentc776498170a2a08a67b1317d8965482cf266a733 (diff)
downloadNim-0b116310bfb691755481293e8f9af11190fe0999.tar.gz
unit separator (#17730)
* use the ASCII Unit Separator so that error messages can be handled precisely by the tooling
* updated testament
Diffstat (limited to 'testament')
-rw-r--r--testament/important_packages.nim2
-rw-r--r--testament/specs.nim2
-rw-r--r--testament/testament.nim7
3 files changed, 9 insertions, 2 deletions
diff --git a/testament/important_packages.nim b/testament/important_packages.nim
index 28d7dc367..ecae42811 100644
--- a/testament/important_packages.nim
+++ b/testament/important_packages.nim
@@ -74,7 +74,7 @@ pkg "gnuplot", "nim c gnuplot.nim"
 pkg "hts", "nim c -o:htss src/hts.nim"
 pkg "httpauth"
 pkg "illwill", "nimble examples"
-pkg "inim"
+pkg "inim", allowFailure=true
 pkg "itertools", "nim doc src/itertools.nim"
 pkg "iterutils"
 pkg "karax", "nim c -r tests/tester.nim"
diff --git a/testament/specs.nim b/testament/specs.nim
index b5e6de7c2..043f14ed3 100644
--- a/testament/specs.nim
+++ b/testament/specs.nim
@@ -202,7 +202,7 @@ proc extractSpec(filename: string; spec: var TSpec): string =
 
   # look for """ only in the first section
   if a >= 0 and b > a and a < 40:
-    result = s.substr(a+3, b-1).replace("'''", tripleQuote)
+    result = s.substr(a+3, b-1).multiReplace({"'''": tripleQuote, "\\31": "\31"})
   else:
     #echo "warning: file does not contain spec: " & filename
     result = ""
diff --git a/testament/testament.nim b/testament/testament.nim
index f2a8e9055..b79b86e51 100644
--- a/testament/testament.nim
+++ b/testament/testament.nim
@@ -18,6 +18,11 @@ import compiler/nodejs
 import lib/stdtest/testutils
 from lib/stdtest/specialpaths import splitTestFile
 
+proc trimUnitSep(x: var string) =
+  let L = x.len
+  if L > 0 and x[^1] == '\31':
+    setLen x, L-1
+
 var useColors = true
 var backendLogging = true
 var simulate = false
@@ -172,6 +177,7 @@ proc callNimCompiler(cmdTemplate, filename, options, nimcache: string,
   result.nimout = ""
   while true:
     if outp.readLine(x):
+      trimUnitSep x
       result.nimout.add(x & '\n')
       if x =~ pegOfInterest:
         # `err` should contain the last error/warning message
@@ -196,6 +202,7 @@ proc callNimCompiler(cmdTemplate, filename, options, nimcache: string,
     result.msg = matches[0]
   elif suc.isSuccess:
     result.err = reSuccess
+  trimUnitSep result.msg
 
 proc callCCompiler(cmdTemplate, filename, options: string,
                   target: TTarget): TSpec =