2021-01-11 16:28:55 +00:00
|
|
|
import unittest
|
|
|
|
export unittest except suite, test
|
2021-01-11 11:02:40 +00:00
|
|
|
|
2021-01-11 16:28:55 +00:00
|
|
|
template suite*(name, body) =
|
|
|
|
suite name:
|
2021-01-11 11:02:40 +00:00
|
|
|
|
2021-01-11 16:41:55 +00:00
|
|
|
template setup(setupBody) {.used.} =
|
2021-01-11 16:28:55 +00:00
|
|
|
setup:
|
|
|
|
let asyncproc = proc {.async.} = setupBody
|
|
|
|
waitFor asyncproc()
|
|
|
|
|
2021-01-11 16:41:55 +00:00
|
|
|
template teardown(teardownBody) {.used.} =
|
2021-01-11 16:28:55 +00:00
|
|
|
teardown:
|
|
|
|
let asyncproc = proc {.async.} = teardownBody
|
|
|
|
waitFor asyncproc()
|
|
|
|
|
|
|
|
let suiteproc = proc = body # Avoids GcUnsafe2 warnings with chronos
|
|
|
|
suiteproc()
|
|
|
|
|
|
|
|
template test*(name, body) =
|
|
|
|
test name:
|
2021-01-11 11:02:40 +00:00
|
|
|
let asyncproc = proc {.async.} = body
|
|
|
|
waitFor asyncproc()
|