add `dualTest` which tests both compile-time and runtime

This commit is contained in:
Jacek Sieka 2023-11-13 08:43:09 +01:00
parent 333e74fa2d
commit 262b697f38
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
2 changed files with 10 additions and 2 deletions

View File

@ -1149,13 +1149,21 @@ template runtimeTest*(nameParam: string, body: untyped) =
template staticTest*(nameParam: string, body: untyped) =
## Similar to `test` but runs only at compiletime, no matter the
## `unittest2Static` setting
## `unittest2Static` flag
static:
block:
echo "[Test ] ", nameParam
body
echo "[", TestStatus.OK, " ] ", nameParam
template dualTest*(nameParam: string, body: untyped) =
## Similar to `test` but run the test both compuletime and run time, no
## matter the `unittest2Static` flag
staticTest nameParam:
body
runtimeTest nameParam:
body
template test*(nameParam: string, body: untyped) =
## Define a single test case identified by `name`.
##

View File

@ -1,6 +1,6 @@
mode = ScriptMode.Verbose
version = "0.2.0"
version = "0.2.1"
author = "Status Research & Development GmbH"
description = "unittest fork with support for parallel test execution"
license = "MIT"