* assertions: properly fix #11545 * tests/assert: enable excessiveStackTrace * tests/assert: add test case for #11545 * tfailedassert_stacktrace: disable excessiveStackTrace * assertions: weird workaround for failing tests This fixes megatest on *nix, but have no idea why
This commit is contained in:
parent
bd55c862a6
commit
2c10b246ec
5 changed files with 22 additions and 7 deletions
|
|
@ -27,13 +27,15 @@ proc failedAssertImpl*(msg: string) {.raises: [], tags: [].} =
|
|||
Hide(raiseAssert)(msg)
|
||||
|
||||
template assertImpl(cond: bool, msg: string, expr: string, enabled: static[bool]) =
|
||||
const loc = $instantiationInfo(-1, true)
|
||||
const
|
||||
loc = instantiationInfo(fullPaths = compileOption("excessiveStackTrace"))
|
||||
ploc = $loc
|
||||
bind instantiationInfo
|
||||
mixin failedAssertImpl
|
||||
when enabled:
|
||||
{.line: instantiationInfo(fullPaths = compileOption("excessiveStackTrace")).}:
|
||||
{.line: loc.}:
|
||||
if not cond:
|
||||
failedAssertImpl(loc & " `" & expr & "` " & msg)
|
||||
failedAssertImpl(ploc & " `" & expr & "` " & msg)
|
||||
|
||||
template assert*(cond: untyped, msg = "") =
|
||||
## Raises ``AssertionError`` with `msg` if `cond` is false. Note
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue