diff options
Diffstat (limited to 'tests/assert/tassert.nim')
-rw-r--r-- | tests/assert/tassert.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/assert/tassert.nim b/tests/assert/tassert.nim new file mode 100644 index 000000000..a14fec317 --- /dev/null +++ b/tests/assert/tassert.nim @@ -0,0 +1,20 @@ +discard """ + outputsub: "assertion failure!this shall be always written" + exitcode: "1" +""" +# test assert and exception handling + +proc callB() = assert(false) +proc callA() = callB() +proc callC() = callA() + +try: + callC() +except AssertionDefect: + write(stdout, "assertion failure!") +except: + write(stdout, "unknown exception!") +finally: + system.write(stdout, "this shall be always written") + +assert(false) #OUT assertion failure!this shall be always written |