2021-01-11 12:02:40 +01:00
|
|
|
import std/unittest
|
|
|
|
import std/asyncdispatch
|
|
|
|
import pkg/asynctest
|
|
|
|
|
2021-01-11 14:23:36 +01:00
|
|
|
proc someAsyncProc {.async.} =
|
|
|
|
# perform some async operations using await
|
|
|
|
discard
|
2021-01-11 12:02:40 +01:00
|
|
|
|
2021-01-11 14:23:36 +01:00
|
|
|
suite "test async proc":
|
2021-01-11 12:02:40 +01:00
|
|
|
|
2021-01-11 14:23:36 +01:00
|
|
|
asyncsetup:
|
|
|
|
# invoke await in the test setup:
|
|
|
|
await someAsyncProc()
|
2021-01-11 12:02:40 +01:00
|
|
|
|
2021-01-11 14:23:36 +01:00
|
|
|
asyncteardown:
|
|
|
|
# invoke await in the test teardown:
|
|
|
|
await someAsyncProc()
|
2021-01-11 12:02:40 +01:00
|
|
|
|
2021-01-11 14:23:36 +01:00
|
|
|
asynctest "async test":
|
|
|
|
# invoke await in tests:
|
|
|
|
await someAsyncProc()
|