summary refs log tree commit diff stats
path: root/tests/assert/tassert.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/assert/tassert.nim')
-rw-r--r--tests/assert/tassert.nim20
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