when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
else:
{.push raises: [].}
import unittest2
suite "test":
setup:
discard
teardown:
raise newException(CatchableError, "teardown exception")
test "test":
raise newException(CatchableError, "text exception")
Running the test above outputs:
//workspace/nim-libp2p/nimbledeps/pkgs/unittest2-#f180f596c88dfd266f746ed6f8dbebce39c824db/unittest2.nim(817) runTest`gensym3
Unhandled exception: teardown exception [CatchableError]
[FAILED] test
A possible improvement was implemented in #18
Nim Compiler Version 1.7.1 [MacOSX: amd64]
Compiled at 2022-08-31
Copyright (c) 2006-2022 by Andreas Rumpf
git hash: d4c0d35b32e51eae06e65e78