summary refs log tree commit diff stats
path: root/tests/tassert.nim
blob: 1eff23502ff811c92410b0ae0cd4ced9a0cab08e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# test assert and exception handling

proc callB() = assert(False)
proc callA() = callB()
proc callC() = callA()

try:
  callC()
except EAssertionFailed:
  write(stdout, "assertion failure!\n")
except:
  write(stdout, "unknown exception!\n")
finally:
  system.write(stdout, "this shall be always written\n")

assert(false)