diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/enum/tenummix.nim | 4 | ||||
-rw-r--r-- | tests/manyloc/keineschweine/lib/zlib_helpers.nim | 2 | ||||
-rw-r--r-- | tests/manyloc/nake/nakefile.nim | 2 | ||||
-rw-r--r-- | tests/method/tmapper.nim | 2 | ||||
-rw-r--r-- | tests/misc/tnot.nim | 7 | ||||
-rw-r--r-- | tests/objects/tillegal_recursion.nim | 2 | ||||
-rw-r--r-- | tests/testament/categories.nim | 3 | ||||
-rw-r--r-- | tests/testament/specs.nim | 8 | ||||
-rw-r--r-- | tests/testament/tester.nim | 25 |
9 files changed, 42 insertions, 13 deletions
diff --git a/tests/enum/tenummix.nim b/tests/enum/tenummix.nim index 4352cdd81..c7db4e056 100644 --- a/tests/enum/tenummix.nim +++ b/tests/enum/tenummix.nim @@ -1,6 +1,6 @@ discard """ - file: "tenummix.nim" - line: 11 + tfile: "tenummix.nim" + tline: 11 errormsg: "type mismatch" """ diff --git a/tests/manyloc/keineschweine/lib/zlib_helpers.nim b/tests/manyloc/keineschweine/lib/zlib_helpers.nim index 5241a77c0..076475964 100644 --- a/tests/manyloc/keineschweine/lib/zlib_helpers.nim +++ b/tests/manyloc/keineschweine/lib/zlib_helpers.nim @@ -1,4 +1,4 @@ -import zlib +import zip/zlib proc compress*(source: string): string = var diff --git a/tests/manyloc/nake/nakefile.nim b/tests/manyloc/nake/nakefile.nim index 6dc453e8d..2fe07ec17 100644 --- a/tests/manyloc/nake/nakefile.nim +++ b/tests/manyloc/nake/nakefile.nim @@ -1,5 +1,5 @@ import nake -import httpclient, zipfiles, times, math +import httpclient, zip/zipfiles, times, math nakeImports randomize() diff --git a/tests/method/tmapper.nim b/tests/method/tmapper.nim index 0008d9033..75b36e69a 100644 --- a/tests/method/tmapper.nim +++ b/tests/method/tmapper.nim @@ -1,5 +1,5 @@ discard """ - errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22,7)" + errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tests/method/tmapper.nim(22,7)" line: 25 """ diff --git a/tests/misc/tnot.nim b/tests/misc/tnot.nim index 60d23c035..8c75c6bc0 100644 --- a/tests/misc/tnot.nim +++ b/tests/misc/tnot.nim @@ -1,6 +1,6 @@ discard """ - file: "tnot.nim" - line: 14 + tfile: "tnot.nim" + tline: 14 errormsg: "type mismatch" """ # BUG: following compiles, but should not: @@ -17,6 +17,3 @@ proc main = echo "No" main() - - - diff --git a/tests/objects/tillegal_recursion.nim b/tests/objects/tillegal_recursion.nim index 171a04f87..222139101 100644 --- a/tests/objects/tillegal_recursion.nim +++ b/tests/objects/tillegal_recursion.nim @@ -1,5 +1,5 @@ discard """ - errormsg: "illegal recursion in type 'object'" + errormsg: "inheritance only works with non-final objects" line: 7 """ # bug #1691 diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index afc4a616f..9de33acb1 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -89,8 +89,11 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) = var libpath = getEnv"LD_LIBRARY_PATH".string # Temporarily add the lib directory to LD_LIBRARY_PATH: putEnv("LD_LIBRARY_PATH", "lib:" & libpath) + defer: putEnv("LD_LIBRARY_PATH", libpath) var serverDll = DynlibFormat % "server" safeCopyFile("tests/dll" / serverDll, "lib" / serverDll) + var nimrtlDll = DynlibFormat % "nimrtl" + safeCopyFile("tests/dll" / nimrtlDll, "lib" / nimrtlDll) testSpec r, makeTest("tests/dll/client.nim", options & " -d:useNimRtl", cat, actionRun) diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim index 99640f22c..bab17d2cd 100644 --- a/tests/testament/specs.nim +++ b/tests/testament/specs.nim @@ -44,6 +44,8 @@ type file*, cmd*: string outp*: string line*, column*: int + tfile*: string + tline*, tcolumn*: int exitCode*: int msg*: string ccodeCheck*: string @@ -101,6 +103,9 @@ proc specDefaults*(result: var TSpec) = result.cmd = cmdTemplate result.line = 0 result.column = 0 + result.tfile = "" + result.tline = 0 + result.tcolumn = 0 proc parseSpec*(filename: string): TSpec = specDefaults(result) @@ -116,6 +121,9 @@ proc parseSpec*(filename: string): TSpec = of "file": result.file = e.value of "line": discard parseInt(e.value, result.line) of "column": discard parseInt(e.value, result.column) + of "tfile": result.tfile = e.value + of "tline": discard parseInt(e.value, result.tline) + of "tcolumn": discard parseInt(e.value, result.tcolumn) of "output": result.action = actionRun result.outp = e.value diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index e52988682..636093a7f 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -53,6 +53,8 @@ type let pegLineError = peg"{[^(]*} '(' {\d+} ', ' {\d+} ') ' ('Error') ':' \s* {.*}" + pegLineTemplate = + peg"{[^(]*} '(' {\d+} ', ' {\d+} ') ' 'template/generic instantiation from here'.*" pegOtherError = peg"'Error:' \s* {.*}" pegSuccess = peg"'Hint: operation successful'.*" pegOfInterest = pegLineError / pegOtherError @@ -66,6 +68,7 @@ proc callCompiler(cmdTemplate, filename, options: string, let outp = p.outputStream var suc = "" var err = "" + var tmpl = "" var x = newStringOfCap(120) result.nimout = "" while outp.readLine(x.TaintedString) or running(p): @@ -73,6 +76,9 @@ proc callCompiler(cmdTemplate, filename, options: string, if x =~ pegOfInterest: # `err` should contain the last error/warning message err = x + elif x =~ pegLineTemplate and err == "": + # `tmpl` contains the last template expansion before the error + tmpl = x elif x =~ pegSuccess: suc = x close(p) @@ -81,6 +87,13 @@ proc callCompiler(cmdTemplate, filename, options: string, result.outp = "" result.line = 0 result.column = 0 + result.tfile = "" + result.tline = 0 + result.tcolumn = 0 + if tmpl =~ pegLineTemplate: + result.tfile = extractFilename(matches[0]) + result.tline = parseInt(matches[1]) + result.tcolumn = parseInt(matches[2]) if err =~ pegLineError: result.file = extractFilename(matches[0]) result.line = parseInt(matches[1]) @@ -154,7 +167,7 @@ proc addResult(r: var TResults, test: TTest, proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = if strip(expected.msg) notin strip(given.msg): r.addResult(test, expected.msg, given.msg, reMsgsDiffer) - elif extractFilename(expected.file) != extractFilename(given.file) and + elif expected.tfile == "" and extractFilename(expected.file) != extractFilename(given.file) and "internal error:" notin expected.msg: r.addResult(test, expected.file, given.file, reFilesDiffer) elif expected.line != given.line and expected.line != 0 or @@ -162,6 +175,14 @@ proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = r.addResult(test, $expected.line & ':' & $expected.column, $given.line & ':' & $given.column, reLinesDiffer) + elif expected.tfile != "" and extractFilename(expected.tfile) != extractFilename(given.tfile) and + "internal error:" notin expected.msg: + r.addResult(test, expected.tfile, given.tfile, reFilesDiffer) + elif expected.tline != given.tline and expected.tline != 0 or + expected.tcolumn != given.tcolumn and expected.tcolumn != 0: + r.addResult(test, $expected.tline & ':' & $expected.tcolumn, + $given.tline & ':' & $given.tcolumn, + reLinesDiffer) else: r.addResult(test, expected.msg, given.msg, reSuccess) inc(r.passed) @@ -282,7 +303,7 @@ proc testSpec(r: var TResults, test: TTest) = return let exeCmd = (if isJsTarget: nodejs & " " else: "") & exeFile - let (buf, exitCode) = execCmdEx(exeCmd) + var (buf, exitCode) = execCmdEx(exeCmd, options = {poStdErrToStdOut}) let bufB = if expected.sortoutput: makeDeterministic(strip(buf.string)) else: strip(buf.string) let expectedOut = strip(expected.outp) |