nim-libp2p/tests/utils/async_tests.nim

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
484 B
Nim
Raw Normal View History

import unittest2, chronos
export unittest2, chronos
template asyncTeardown*(body: untyped): untyped =
teardown:
waitFor(
(
proc() {.async.} =
body
)()
)
template asyncSetup*(body: untyped): untyped =
setup:
waitFor(
(
proc() {.async.} =
body
)()
)
template asyncTest*(name: string, body: untyped): untyped =
test name:
waitFor(
(
proc() {.async.} =
body
)()
)