diff options
Diffstat (limited to 'lib/pure/unittest.nim')
-rw-r--r-- | lib/pure/unittest.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 2322ffd69..db3e5a1db 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -18,7 +18,7 @@ ## import - macros + macros, terminal type TestStatus* = enum OK, FAILED @@ -45,6 +45,10 @@ template suite*(name: expr, body: stmt): stmt = body +proc printStatus*(s: TestStatus, name: string) = + var color = (if s == OK: fgGreen else: fgRed) + styledEcho styleBright, color, "[", $s, "] ", fgWhite, name, "\n" + template test*(name: expr, body: stmt): stmt = if bind shouldRun(name): bind checkpoints = @[] @@ -56,7 +60,7 @@ template test*(name: expr, body: stmt): stmt = finally: TestTeardownIMPL() - echo "[" & $TestStatusIMPL & "] " & name & "\n" + printStatus(TestStatusIMPL, name) proc checkpoint*(msg: string) = checkpoints.add(msg) |