mirror of
https://github.com/status-im/asynctest.git
synced 2025-02-23 10:08:20 +00:00
`before` executes async code before all tests in the suite. `after` executes async code after all tests in the suite.
32 lines
650 B
Nim
32 lines
650 B
Nim
proc someAsyncProc {.async.} =
|
|
# perform some async operations using await
|
|
discard
|
|
|
|
suite "test async proc":
|
|
|
|
setup:
|
|
# invoke await in the test setup:
|
|
await someAsyncProc()
|
|
|
|
teardown:
|
|
# invoke await in the test teardown:
|
|
await someAsyncProc()
|
|
|
|
test "async test":
|
|
# invoke await in tests:
|
|
await someAsyncProc()
|
|
|
|
suite "test async setupAll and teardownAll, allow multiple suites":
|
|
|
|
setupAll:
|
|
# invoke await in the test setup:
|
|
await someAsyncProc()
|
|
|
|
teardownAll:
|
|
# invoke await in the test teardown:
|
|
await someAsyncProc()
|
|
|
|
test "async test":
|
|
# invoke await in tests:
|
|
await someAsyncProc()
|