* fixes #17033 [backport:1.4] * make test robust against stdlib gensym things * cleanup assertions.nim to make topt_no_cursor easier to get right
This commit is contained in:
parent
b9994925f5
commit
f32ffb6ed8
3 changed files with 105 additions and 9 deletions
|
|
@ -86,13 +86,11 @@ template assert*(cond: untyped, msg = "") =
|
|||
##
|
||||
## No code will be generated for `assert` when passing `-d:danger` (implied by `--assertions:off`).
|
||||
## See `command line switches <nimc.html#compiler-usage-commandminusline-switches>`_.
|
||||
const expr = astToStr(cond)
|
||||
assertImpl(cond, msg, expr, compileOption("assertions"))
|
||||
assertImpl(cond, msg, astToStr(cond), compileOption("assertions"))
|
||||
|
||||
template doAssert*(cond: untyped, msg = "") =
|
||||
## Similar to `assert <#assert.t,untyped,string>`_ but is always turned on regardless of `--assertions`.
|
||||
const expr = astToStr(cond)
|
||||
assertImpl(cond, msg, expr, true)
|
||||
assertImpl(cond, msg, astToStr(cond), true)
|
||||
|
||||
template onFailedAssert*(msg, code: untyped): untyped {.dirty.} =
|
||||
## Sets an assertion failure handler that will intercept any assert
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue