further improvements to the error messages produced by concepts

This commit is contained in:
Zahary Karadjov 2016-08-24 01:55:45 +03:00
commit fe48dd1cbe
8 changed files with 85 additions and 54 deletions

View file

@ -63,6 +63,8 @@ let
var targets = {low(TTarget)..high(TTarget)}
proc normalizeMsg(s: string): string = s.strip.replace("\C\L", "\L")
proc callCompiler(cmdTemplate, filename, options: string,
target: TTarget): TSpec =
let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target],
@ -184,7 +186,7 @@ proc addResult(r: var TResults, test: TTest,
proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) =
if strip(expected.msg) notin strip(given.msg):
r.addResult(test, expected.msg, given.msg, reMsgsDiffer)
elif expected.nimout.len > 0 and expected.nimout.normalize notin given.nimout.normalize:
elif expected.nimout.len > 0 and expected.nimout.normalizeMsg notin given.nimout.normalizeMsg:
r.addResult(test, expected.nimout, given.nimout, reMsgsDiffer)
elif expected.tfile == "" and extractFilename(expected.file) != extractFilename(given.file) and
"internal error:" notin expected.msg:
@ -235,8 +237,6 @@ proc nimoutCheck(test: TTest; expectedNimout: string; given: var TSpec) =
if exp notin giv:
given.err = reMsgsDiffer
proc normalize(s: string): string = s.strip.replace("\C\L", "\L")
proc makeDeterministic(s: string): string =
var x = splitLines(s)
sort(x, system.cmp)