mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-11 22:08:54 +00:00
* fixes #21261; always checking nimTestErrorFlag in the main module * add a test
This commit is contained in:
@@ -1801,6 +1801,9 @@ proc genInitCode(m: BModule) =
|
||||
|
||||
if optStackTrace in m.initProc.options and preventStackTrace notin m.flags:
|
||||
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", [])
|
||||
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user