mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 04:27:44 +00:00
Generally useful refactoring as it produces better code.
(cherry picked from commit 0f7b378467)
27 lines
501 B
Nim
27 lines
501 B
Nim
discard """
|
|
matrix: "--stackTrace:on --excessiveStackTrace:off"
|
|
"""
|
|
|
|
const expected = """
|
|
wrong trace:
|
|
t23536.nim(22) t23536
|
|
t23536.nim(17) foo
|
|
assertions.nim(45) failedAssertImpl
|
|
assertions.nim(40) raiseAssert
|
|
fatal.nim(53) sysFatal
|
|
"""
|
|
|
|
|
|
try:
|
|
proc foo = # bug #23536
|
|
doAssert false
|
|
|
|
for i in 0 .. 1:
|
|
|
|
|
|
foo()
|
|
except AssertionDefect:
|
|
let e = getCurrentException()
|
|
let trace = e.getStackTrace
|
|
doAssert "wrong trace:\n" & trace == expected
|