diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2021-01-04 11:27:58 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 18:27:58 +0100 |
commit | 9531afac48aff3d5f0a6093742f60c95b043b08f (patch) | |
tree | f84da49fadbe91533b5cf70535fff28b5329fbf4 | |
parent | 0d67ad0bf38a69d110558a6eaa525e25cbf90648 (diff) | |
download | Nim-9531afac48aff3d5f0a6093742f60c95b043b08f.tar.gz |
fix #16499 (#16514)
-rw-r--r-- | lib/system/fatal.nim | 24 | ||||
-rw-r--r-- | tests/assert/tassert_c.nim | 2 |
2 files changed, 15 insertions, 11 deletions
diff --git a/lib/system/fatal.nim b/lib/system/fatal.nim index 761e0dd69..64ec9cda3 100644 --- a/lib/system/fatal.nim +++ b/lib/system/fatal.nim @@ -30,16 +30,20 @@ elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript): proc name(t: typedesc): string {.magic: "TypeTrait".} proc sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} = - writeStackTrace() - var buf = newStringOfCap(200) - add(buf, "Error: unhandled exception: ") - add(buf, message) - add(buf, arg) - add(buf, " [") - add(buf, name exceptn) - add(buf, "]\n") - cstderr.rawWrite buf - quit 1 + when nimvm: + # TODO when doAssertRaises works in CT, add a test for it + raise (ref exceptn)(msg: message & arg) + else: + writeStackTrace() + var buf = newStringOfCap(200) + add(buf, "Error: unhandled exception: ") + add(buf, message) + add(buf, arg) + add(buf, " [") + add(buf, name exceptn) + add(buf, "]\n") + cstderr.rawWrite buf + quit 1 proc sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} = sysFatal(exceptn, message, "") diff --git a/tests/assert/tassert_c.nim b/tests/assert/tassert_c.nim index c6a2eadb1..024175cbf 100644 --- a/tests/assert/tassert_c.nim +++ b/tests/assert/tassert_c.nim @@ -8,7 +8,7 @@ tassert_c.nim(35) tassert_c tassert_c.nim(34) foo assertions.nim(30) failedAssertImpl assertions.nim(23) raiseAssert -fatal.nim(49) sysFatal""" +fatal.nim(53) sysFatal""" proc tmatch(x, p: string): bool = var i = 0 |