mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-10 13:05:48 +00:00
bd594c9aaf
* adding tracker for streamstore * adding tracker tests * Sets up tracker helper functions and closes streams in testnode.nim * Deploying checksuite for memory leak tracker checking. * Successfully deploys checksuite and asyncchecksuite. * Fix leak in testpor.nim * Fixes leaked storestream in testnetwork.nim * Fixes integration tests * Cleanup * cleanup comment by Mark --------- Co-authored-by: benbierens <thatbenbierens@gmail.com>
39 lines
886 B
Nim
39 lines
886 B
Nim
import pkg/chronos
|
|
|
|
# Allow multiple setups and teardowns in a test suite
|
|
template asyncmultisetup* =
|
|
var setups: seq[proc: Future[void] {.gcsafe.}]
|
|
var teardowns: seq[proc: Future[void] {.gcsafe.}]
|
|
|
|
setup:
|
|
for setup in setups:
|
|
await setup()
|
|
|
|
teardown:
|
|
for teardown in teardowns:
|
|
await teardown()
|
|
|
|
template setup(setupBody) {.inject.} =
|
|
setups.add(proc {.async.} = setupBody)
|
|
|
|
template teardown(teardownBody) {.inject.} =
|
|
teardowns.insert(proc {.async.} = teardownBody)
|
|
|
|
template multisetup* =
|
|
var setups: seq[proc() {.gcsafe.}]
|
|
var teardowns: seq[proc() {.gcsafe.}]
|
|
|
|
setup:
|
|
for setup in setups:
|
|
setup()
|
|
|
|
teardown:
|
|
for teardown in teardowns:
|
|
teardown()
|
|
|
|
template setup(setupBody) {.inject.} =
|
|
setups.add(proc = setupBody)
|
|
|
|
template teardown(teardownBody) {.inject.} =
|
|
teardowns.insert(proc = teardownBody)
|