asynctest/asynctest.nim
Mark Spanbroek 737f01326c Make API identical to std/unittest
Also includes a fix for GcUnsafe2 warnings with chronos.
2021-01-11 17:28:55 +01:00

24 lines
557 B
Nim

import unittest
export unittest except suite, test
template suite*(name, body) =
suite name:
template setup(setupBody) =
setup:
let asyncproc = proc {.async.} = setupBody
waitFor asyncproc()
template teardown(teardownBody) =
teardown:
let asyncproc = proc {.async.} = teardownBody
waitFor asyncproc()
let suiteproc = proc = body # Avoids GcUnsafe2 warnings with chronos
suiteproc()
template test*(name, body) =
test name:
let asyncproc = proc {.async.} = body
waitFor asyncproc()