doAssert, assert now print full path of failing line on error (#8555)

This commit is contained in:
Timothee Cour 2018-08-25 12:48:37 -07:00 • committed by Andreas Rumpf
commit 3a626179ee
6 changed files with 109 additions and 32 deletions

View file

@ -0,0 +1,12 @@
from strutils import endsWith, split
from ospaths import isAbsolute
proc checkMsg*(msg, expectedEnd, name: string)=
let filePrefix = msg.split(' ', maxSplit = 1)[0]
if not filePrefix.isAbsolute:
echo name, ":not absolute: `", msg & "`"
elif not msg.endsWith expectedEnd:
echo name, ":expected suffix:\n`" & expectedEnd & "`\ngot:\n`" & msg & "`"
else:
echo name, ":ok"