parent
0bff52a779
commit
133d86a58e
|
@ -690,7 +690,7 @@ template suite*(name, body) {.dirty.} =
|
||||||
|
|
||||||
template exceptionTypeName(e: typed): string = $e.name
|
template exceptionTypeName(e: typed): string = $e.name
|
||||||
|
|
||||||
template test*(name, body) =
|
template test*(name: string, body: untyped) =
|
||||||
## Define a single test case identified by `name`.
|
## Define a single test case identified by `name`.
|
||||||
##
|
##
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
|
@ -704,10 +704,7 @@ template test*(name, body) =
|
||||||
## .. code-block::
|
## .. code-block::
|
||||||
##
|
##
|
||||||
## [OK] roses are red
|
## [OK] roses are red
|
||||||
bind shouldRun, checkpoints, testEnded, exceptionTypeName
|
bind shouldRun, checkpoints, testStarted, testEnded, exceptionTypeName
|
||||||
withLock formattersLock:
|
|
||||||
{.gcsafe.}:
|
|
||||||
bind formatters
|
|
||||||
|
|
||||||
# `gensym` can't be in here because it's not a first-class pragma
|
# `gensym` can't be in here because it's not a first-class pragma
|
||||||
when paralleliseTests:
|
when paralleliseTests:
|
||||||
|
@ -747,7 +744,7 @@ template test*(name, body) =
|
||||||
programResult = 1
|
programResult = 1
|
||||||
let testResult = TestResult(
|
let testResult = TestResult(
|
||||||
suiteName: testSuiteName,
|
suiteName: testSuiteName,
|
||||||
testName: name,
|
testName: testName,
|
||||||
status: testStatusIMPL,
|
status: testStatusIMPL,
|
||||||
duration: getMonoTime() - startTime
|
duration: getMonoTime() - startTime
|
||||||
)
|
)
|
||||||
|
@ -755,11 +752,12 @@ template test*(name, body) =
|
||||||
checkpoints = @[]
|
checkpoints = @[]
|
||||||
|
|
||||||
let optionalTestSuiteName = when declared(testSuiteName): testSuiteName else: ""
|
let optionalTestSuiteName = when declared(testSuiteName): testSuiteName else: ""
|
||||||
if shouldRun(optionalTestSuiteName, name):
|
let tname = name
|
||||||
|
if shouldRun(optionalTestSuiteName, tname):
|
||||||
when paralleliseTests:
|
when paralleliseTests:
|
||||||
flowVars.add(spawn runTest(optionalTestSuiteName, name))
|
flowVars.add(spawn runTest(optionalTestSuiteName, tname))
|
||||||
else:
|
else:
|
||||||
discard runTest(optionalTestSuiteName, name)
|
discard runTest(optionalTestSuiteName, tname)
|
||||||
|
|
||||||
proc checkpoint*(msg: string) =
|
proc checkpoint*(msg: string) =
|
||||||
## Set a checkpoint identified by `msg`. Upon test failure all
|
## Set a checkpoint identified by `msg`. Upon test failure all
|
||||||
|
|
Loading…
Reference in New Issue