mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
21 lines
461 B
Nim
21 lines
461 B
Nim
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 AssertionError:
|
|
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
|