Implemented SKIPPED test status
This commit is contained in:
parent
cc80eac84b
commit
d91b0cbc2b
1 changed files with 25 additions and 2 deletions
|
|
@ -41,7 +41,11 @@ when not defined(ECMAScript):
|
||||||
import terminal
|
import terminal
|
||||||
|
|
||||||
type
|
type
|
||||||
TestStatus* = enum OK, FAILED ## The status of a test when it is done.
|
TestStatus* = enum ## The status of a test when it is done.
|
||||||
|
OK,
|
||||||
|
FAILED,
|
||||||
|
SKIPPED
|
||||||
|
|
||||||
OutputLevel* = enum ## The output verbosity of the tests.
|
OutputLevel* = enum ## The output verbosity of the tests.
|
||||||
PRINT_ALL, ## Print as much as possible.
|
PRINT_ALL, ## Print as much as possible.
|
||||||
PRINT_FAILURES, ## Print only the failed tests.
|
PRINT_FAILURES, ## Print only the failed tests.
|
||||||
|
|
@ -120,7 +124,11 @@ proc testDone(name: string, s: TestStatus) =
|
||||||
template rawPrint() = echo("[", $s, "] ", name)
|
template rawPrint() = echo("[", $s, "] ", name)
|
||||||
when not defined(ECMAScript):
|
when not defined(ECMAScript):
|
||||||
if colorOutput and not defined(ECMAScript):
|
if colorOutput and not defined(ECMAScript):
|
||||||
var color = (if s == OK: fgGreen else: fgRed)
|
var color = case s
|
||||||
|
of OK: fgGreen
|
||||||
|
of FAILED: fgRed
|
||||||
|
of SKIPPED: fgYellow
|
||||||
|
else: fgWhite
|
||||||
styledEcho styleBright, color, "[", $s, "] ", fgWhite, name
|
styledEcho styleBright, color, "[", $s, "] ", fgWhite, name
|
||||||
else:
|
else:
|
||||||
rawPrint()
|
rawPrint()
|
||||||
|
|
@ -203,6 +211,21 @@ template fail* =
|
||||||
|
|
||||||
checkpoints = @[]
|
checkpoints = @[]
|
||||||
|
|
||||||
|
template skip* =
|
||||||
|
## Makes test to be skipped. Should be used directly
|
||||||
|
## in case when it is not possible to perform test
|
||||||
|
## for reasons depending on outer environment,
|
||||||
|
## or certain application logic conditions or configurations.
|
||||||
|
##
|
||||||
|
## .. code-block:: nim
|
||||||
|
##
|
||||||
|
## if not isGLConextCreated():
|
||||||
|
## skip()
|
||||||
|
bind checkpoints
|
||||||
|
|
||||||
|
testStatusIMPL = SKIPPED
|
||||||
|
checkpoints = @[]
|
||||||
|
|
||||||
macro check*(conditions: stmt): stmt {.immediate.} =
|
macro check*(conditions: stmt): stmt {.immediate.} =
|
||||||
## Verify if a statement or a list of statements is true.
|
## Verify if a statement or a list of statements is true.
|
||||||
## A helpful error message and set checkpoints are printed out on
|
## A helpful error message and set checkpoints are printed out on
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue