Merge pull request #8941 from timotheecour/pr_fix_8928
fix #8928 regression
This commit is contained in:
commit
8f046792cf
2 changed files with 24 additions and 2 deletions
|
|
@ -3784,6 +3784,9 @@ template assertImpl(cond: bool, msg = "", enabled: static[bool]) =
|
||||||
bind instantiationInfo
|
bind instantiationInfo
|
||||||
mixin failedAssertImpl
|
mixin failedAssertImpl
|
||||||
when enabled:
|
when enabled:
|
||||||
|
# for stacktrace; fixes #8928 ; Note: `fullPaths = true` is correct
|
||||||
|
# here, regardless of --excessiveStackTrace
|
||||||
|
{.line: instantiationInfo(fullPaths = true).}:
|
||||||
if not cond:
|
if not cond:
|
||||||
failedAssertImpl(loc & " `" & astToStr(cond) & "` " & msg)
|
failedAssertImpl(loc & " `" & astToStr(cond) & "` " & msg)
|
||||||
|
|
||||||
|
|
|
||||||
19
tests/assert/tfailedassert_stacktrace.nim
Normal file
19
tests/assert/tfailedassert_stacktrace.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
discard """
|
||||||
|
output: '''
|
||||||
|
tfailedassert_stacktrace.nim(16) tfailedassert_stacktrace
|
||||||
|
tfailedassert_stacktrace.nim(15) foo
|
||||||
|
system.nim(3777) failedAssertImpl
|
||||||
|
system.nim(3770) raiseAssert
|
||||||
|
system.nim(2817) sysFatal
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
proc foo() =
|
||||||
|
assert(false)
|
||||||
|
foo()
|
||||||
|
except AssertionError:
|
||||||
|
let e = getCurrentException()
|
||||||
|
echo e.getStackTrace
|
||||||
Loading…
Add table
Add a link
Reference in a new issue