* fixes #21261; always checking nimTestErrorFlag in the main module * add a test
This commit is contained in:
parent
5e7f7109e1
commit
d54a7f078d
3 changed files with 13 additions and 0 deletions
|
|
@ -1801,6 +1801,9 @@ proc genInitCode(m: BModule) =
|
||||||
|
|
||||||
if optStackTrace in m.initProc.options and preventStackTrace notin m.flags:
|
if optStackTrace in m.initProc.options and preventStackTrace notin m.flags:
|
||||||
prc.add(deinitFrame(m.initProc))
|
prc.add(deinitFrame(m.initProc))
|
||||||
|
elif sfMainModule in m.module.flags and m.config.exc == excGoto:
|
||||||
|
if getCompilerProc(m.g.graph, "nimTestErrorFlag") != nil:
|
||||||
|
m.appcg(prc, "\t#nimTestErrorFlag();$n", [])
|
||||||
|
|
||||||
prc.addf("}$N", [])
|
prc.addf("}$N", [])
|
||||||
|
|
||||||
|
|
|
||||||
1
tests/exception/m21261.nim
Normal file
1
tests/exception/m21261.nim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
raise (ref Exception)(msg: "something")
|
||||||
9
tests/exception/t21261.nim
Normal file
9
tests/exception/t21261.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
discard """
|
||||||
|
exitcode: 1
|
||||||
|
outputsub: '''
|
||||||
|
m21261.nim(1) m21261
|
||||||
|
Error: unhandled exception: something [Exception]
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
import m21261
|
||||||
Loading…
Add table
Add a link
Reference in a new issue