2023-03-24 15:42:49 +00:00
|
|
|
import unittest2, chronos
|
2021-05-21 16:27:01 +00:00
|
|
|
|
2023-03-24 15:42:49 +00:00
|
|
|
export unittest2, chronos
|
2021-05-21 16:27:01 +00:00
|
|
|
|
|
|
|
template asyncTeardown*(body: untyped): untyped =
|
|
|
|
teardown:
|
|
|
|
waitFor(
|
2024-06-11 15:18:06 +00:00
|
|
|
(
|
2023-12-05 07:05:32 +00:00
|
|
|
proc() {.async.} =
|
2021-05-21 16:27:01 +00:00
|
|
|
body
|
|
|
|
)()
|
2024-06-11 15:18:06 +00:00
|
|
|
)
|
2021-05-21 16:27:01 +00:00
|
|
|
|
|
|
|
template asyncSetup*(body: untyped): untyped =
|
|
|
|
setup:
|
|
|
|
waitFor(
|
2024-06-11 15:18:06 +00:00
|
|
|
(
|
2023-12-05 07:05:32 +00:00
|
|
|
proc() {.async.} =
|
2021-05-21 16:27:01 +00:00
|
|
|
body
|
|
|
|
)()
|
2024-06-11 15:18:06 +00:00
|
|
|
)
|
2021-05-21 16:27:01 +00:00
|
|
|
|
|
|
|
template asyncTest*(name: string, body: untyped): untyped =
|
|
|
|
test name:
|
|
|
|
waitFor(
|
2024-06-11 15:18:06 +00:00
|
|
|
(
|
2023-12-05 07:05:32 +00:00
|
|
|
proc() {.async.} =
|
2021-05-21 16:27:01 +00:00
|
|
|
body
|
|
|
|
)()
|
2024-06-11 15:18:06 +00:00
|
|
|
)
|