mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 07:51:32 +00:00
make some tests red :) (i.e. print failure details while running the tester)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
discard """
|
||||
line: 11
|
||||
file: "tbindtypedesc.nim"
|
||||
errormsg: "type mismatch: got (typedesc[float], string)"
|
||||
"""
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
line: 1912
|
||||
line: 1913
|
||||
file: "system.nim"
|
||||
errormsg: "can raise an unlisted exception: ref EIO"
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
msg: "type mismatch: got (PTest)"
|
||||
errormsg: "type mismatch: got (PTest)"
|
||||
"""
|
||||
|
||||
type
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import
|
||||
parseutils, strutils, pegs, os, osproc, streams, parsecfg, json,
|
||||
marshal, backend, parseopt, specs, htmlgen, browsers
|
||||
marshal, backend, parseopt, specs, htmlgen, browsers, terminal
|
||||
|
||||
const
|
||||
resultsFile = "testresults.html"
|
||||
@@ -109,7 +109,12 @@ proc addResult(r: var TResults, test: TTest,
|
||||
expected = expected,
|
||||
given = given)
|
||||
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
|
||||
echo " [", $success, "]"
|
||||
if success notin {reSuccess, reIgnored}:
|
||||
styledEcho styleBright, fgRed, "^^^ [", $success, "]"
|
||||
styledEcho styleDim, "EXPECTED:"
|
||||
echo expected
|
||||
styledEcho styleDim, "GIVEN:"
|
||||
echo given
|
||||
|
||||
proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) =
|
||||
if strip(expected.msg) notin strip(given.msg):
|
||||
@@ -147,7 +152,7 @@ proc testSpec(r: var TResults, test: TTest) =
|
||||
# major entry point for a single test
|
||||
let tname = test.name.addFileExt(".nim")
|
||||
inc(r.total)
|
||||
stdout.write extractFilename(tname)
|
||||
echo extractFilename(tname)
|
||||
var expected = parseSpec(tname)
|
||||
if expected.err == reIgnored:
|
||||
r.addResult(test, "", "", reIgnored)
|
||||
|
||||
Reference in New Issue
Block a user