diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-06-19 14:41:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-19 14:41:43 -0700 |
commit | ad5063aed101f0102fb867f0b4e518ede7fa188b (patch) | |
tree | c6430d089ef3fcece88c3eda95656d41ce960ab9 /testament/lib/stdtest/testutils.nim | |
parent | 7714ab468a665e772c6d37d39038974cbcea75dc (diff) | |
download | Nim-ad5063aed101f0102fb867f0b4e518ede7fa188b.tar.gz |
testutils.assertAll: show correct location on assert failure (#18299)
Diffstat (limited to 'testament/lib/stdtest/testutils.nim')
-rw-r--r-- | testament/lib/stdtest/testutils.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/testament/lib/stdtest/testutils.nim b/testament/lib/stdtest/testutils.nim index 6d8620dc7..a5476b8d7 100644 --- a/testament/lib/stdtest/testutils.nim +++ b/testament/lib/stdtest/testutils.nim @@ -107,10 +107,12 @@ macro assertAll*(body) = # remove this once these support VM, pending #10129 (closed but not yet fixed) result = newStmtList() for a in body: - result.add genAst(a) do: + result.add genAst(a, a2 = a.repr, info = lineInfo(a)) do: # D20210421T014713:here # xxx pending https://github.com/nim-lang/Nim/issues/12030, # `typeof` should introduce its own scope, so that this # is sufficient: `typeof(a)` instead of `typeof(block: a)` when typeof(block: a) is void: a - else: doAssert a + else: + if not a: + raise newException(AssertionDefect, info & " " & a2) |