Added test duration output (#6619)

This commit is contained in:
Dmitry Atamanov 2017-12-15 21:13:57 +03:00 • committed by Andreas Rumpf
commit 1de3938008

View file

@ -158,6 +158,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
expected, given: string, success: TResultEnum) = expected, given: string, success: TResultEnum) =
let name = test.name.extractFilename & " " & $target & test.options let name = test.name.extractFilename & " " & $target & test.options
let duration = epochTime() - test.startTime let duration = epochTime() - test.startTime
let durationStr = duration.formatFloat(ffDecimal, precision = 8)
backend.writeTestResult(name = name, backend.writeTestResult(name = name,
category = test.cat.string, category = test.cat.string,
target = $target, target = $target,
@ -167,7 +168,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
given = given) given = given)
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success) r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
if success == reSuccess: if success == reSuccess:
styledEcho fgGreen, "PASS: ", fgCyan, name styledEcho fgGreen, "PASS: ", fgCyan, alignLeft(name, 60), fgBlue, " (", durationStr, " secs)"
elif success == reIgnored: elif success == reIgnored:
styledEcho styleDim, fgYellow, "SKIP: ", styleBright, fgCyan, name styledEcho styleDim, fgYellow, "SKIP: ", styleBright, fgCyan, name
else: else: