mirror of
https://github.com/logos-storage/asynctest.git
synced 2026-01-03 05:23:12 +00:00
29 lines
584 B
Nim
29 lines
584 B
Nim
|
|
import std/exitprocs
|
||
|
|
|
||
|
|
template silent(body) =
|
||
|
|
|
||
|
|
let exitcode = getProgramResult()
|
||
|
|
resetOutputFormatters()
|
||
|
|
addOutputFormatter(OutputFormatter())
|
||
|
|
|
||
|
|
body
|
||
|
|
|
||
|
|
resetOutputFormatters()
|
||
|
|
addOutputFormatter(defaultConsoleFormatter())
|
||
|
|
setProgramResult(exitcode)
|
||
|
|
|
||
|
|
suite "reports unhandled exception when teardown handles exceptions too":
|
||
|
|
|
||
|
|
silent:
|
||
|
|
|
||
|
|
proc someAsyncProc {.async.} = discard
|
||
|
|
|
||
|
|
teardown:
|
||
|
|
try:
|
||
|
|
await someAsyncProc()
|
||
|
|
except:
|
||
|
|
discard
|
||
|
|
|
||
|
|
test "should fail, but not crash":
|
||
|
|
raise newException(ValueError, "This exception is expected")
|