tassert.nim 485 B

123456789101112131415161718192021222324
  1. discard """
  2. file: "tassert.nim"
  3. outputsub: "assertion failure!this shall be always written"
  4. exitcode: "1"
  5. """
  6. # test assert and exception handling
  7. proc callB() = assert(false)
  8. proc callA() = callB()
  9. proc callC() = callA()
  10. try:
  11. callC()
  12. except AssertionError:
  13. write(stdout, "assertion failure!")
  14. except:
  15. write(stdout, "unknown exception!")
  16. finally:
  17. system.write(stdout, "this shall be always written")
  18. assert(false) #OUT assertion failure!this shall be always written