Files
Nim/tests/tassert.nim
2010-01-16 23:16:29 +01:00

17 lines
385 B
Nim
Executable File

# test assert and exception handling
proc callB() = assert(False)
proc callA() = callB()
proc callC() = callA()
try:
callC()
except EAssertionFailed:
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