nwaku/tests/testlib/testasync.nim

17 lines
388 B
Nim

# Sourced from: vendor/nim-libp2p/tests/testutils.nim
# Adds the ability for asyncSetup and asyncTeardown to be used in unittest2
template asyncTeardown*(body: untyped): untyped =
teardown:
waitFor((
proc() {.async, gcsafe.} =
body
)())
template asyncSetup*(body: untyped): untyped =
setup:
waitFor((
proc() {.async, gcsafe.} =
body
)())