mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-28 18:24:01 +00:00
* use `{.push warning[BareExcept]:off.}` to override settings temporarily
* likewise, suppress expect
This commit is contained in:
@@ -98,7 +98,7 @@ template doAssertRaises*(exception: typedesc, code: untyped) =
|
||||
const begin = "expected raising '" & astToStr(exception) & "', instead"
|
||||
const msgEnd = " by: " & astToStr(code)
|
||||
template raisedForeign {.gensym.} = raiseAssert(begin & " raised foreign exception" & msgEnd)
|
||||
{.warning[BareExcept]:off.}
|
||||
{.push warning[BareExcept]:off.}
|
||||
when Exception is exception:
|
||||
try:
|
||||
if true:
|
||||
@@ -117,6 +117,6 @@ template doAssertRaises*(exception: typedesc, code: untyped) =
|
||||
mixin `$` # alternatively, we could define $cstring in this module
|
||||
raiseAssert(begin & " raised '" & $e.name & "'" & msgEnd)
|
||||
except: raisedForeign()
|
||||
{.warning[BareExcept]:on.}
|
||||
{.pop.}
|
||||
if wrong:
|
||||
raiseAssert(begin & " nothing was raised" & msgEnd)
|
||||
|
||||
Reference in New Issue
Block a user