From 2c10b246ec8319a9f065d5ef50fc891eeffc7ad9 Mon Sep 17 00:00:00 2001 From: alaviss Date: Mon, 1 Jul 2019 11:19:07 +0000 Subject: assertions: fixes #11545 (#11605) * 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 --- lib/system/assertions.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/system/assertions.nim b/lib/system/assertions.nim index 67f94aa1f..0a1ec5950 100644 --- a/lib/system/assertions.nim +++ b/lib/system/assertions.nim @@ -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 -- cgit 1.4.1-2-gfad0