Make use of used in unittest (#5410)
This commit is contained in:
parent
16aafddee5
commit
f250c30b9d
3 changed files with 45 additions and 14 deletions
|
|
@ -95,7 +95,7 @@ proc shouldRun(testName: string): bool =
|
|||
result = true
|
||||
|
||||
proc startSuite(name: string) =
|
||||
template rawPrint() = echo("\n[Suite] ", name)
|
||||
template rawPrint() = echo("\n[Suite] ", name)
|
||||
when not defined(ECMAScript):
|
||||
if colorOutput:
|
||||
styledEcho styleBright, fgBlue, "\n[Suite] ", resetStyle, name
|
||||
|
|
@ -134,15 +134,15 @@ template suite*(name, body) {.dirty.} =
|
|||
## [OK] (2 + -2) != 4
|
||||
block:
|
||||
bind startSuite
|
||||
template setup(setupBody: untyped) {.dirty.} =
|
||||
var testSetupIMPLFlag = true
|
||||
template setup(setupBody: untyped) {.dirty, used.} =
|
||||
var testSetupIMPLFlag {.used.} = true
|
||||
template testSetupIMPL: untyped {.dirty.} = setupBody
|
||||
|
||||
template teardown(teardownBody: untyped) {.dirty.} =
|
||||
var testTeardownIMPLFlag = true
|
||||
template teardown(teardownBody: untyped) {.dirty, used.} =
|
||||
var testTeardownIMPLFlag {.used.} = true
|
||||
template testTeardownIMPL: untyped {.dirty.} = teardownBody
|
||||
|
||||
let testInSuiteImplFlag = true
|
||||
let testInSuiteImplFlag {.used.} = true
|
||||
startSuite name
|
||||
body
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue