udpated the compiler and tester to use getOrDefault
This commit is contained in:
parent
2fda95a4d6
commit
8be9e46403
19 changed files with 82 additions and 59 deletions
|
|
@ -64,7 +64,7 @@ proc callCompiler(cmdTemplate, filename, options: string,
|
|||
let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target],
|
||||
"options", options, "file", filename.quoteShell])
|
||||
var p = startProcess(command=c[0], args=c[1.. ^1],
|
||||
options={poStdErrToStdOut, poUseShell})
|
||||
options={poStdErrToStdOut, poUsePath})
|
||||
let outp = p.outputStream
|
||||
var suc = ""
|
||||
var err = ""
|
||||
|
|
@ -195,7 +195,7 @@ proc generatedFile(path, name: string, target: TTarget): string =
|
|||
|
||||
proc codegenCheck(test: TTest, check: string, given: var TSpec) =
|
||||
try:
|
||||
let (path, name, ext2) = test.name.splitFile
|
||||
let (path, name, _) = test.name.splitFile
|
||||
let genFile = generatedFile(path, name, test.target)
|
||||
let contents = readFile(genFile).string
|
||||
if check[0] == '\\':
|
||||
|
|
@ -287,7 +287,7 @@ proc testSpec(r: var TResults, test: TTest) =
|
|||
let isJsTarget = test.target == targetJS
|
||||
var exeFile: string
|
||||
if isJsTarget:
|
||||
let (dir, file, ext) = splitFile(tname)
|
||||
let (dir, file, _) = splitFile(tname)
|
||||
exeFile = dir / "nimcache" / file & ".js" # *TODO* hardcoded "nimcache"
|
||||
else:
|
||||
exeFile = changeFileExt(tname, ExeExt)
|
||||
|
|
@ -332,7 +332,7 @@ proc testSpec(r: var TResults, test: TTest) =
|
|||
|
||||
proc testNoSpec(r: var TResults, test: TTest) =
|
||||
# does not extract the spec because the file is not supposed to have any
|
||||
let tname = test.name.addFileExt(".nim")
|
||||
#let tname = test.name.addFileExt(".nim")
|
||||
inc(r.total)
|
||||
let given = callCompiler(cmdTemplate, test.name, test.options, test.target)
|
||||
r.addResult(test, "", given.msg, given.err)
|
||||
|
|
@ -348,7 +348,7 @@ proc testC(r: var TResults, test: TTest) =
|
|||
r.addResult(test, "", given.msg, given.err)
|
||||
elif test.action == actionRun:
|
||||
let exeFile = changeFileExt(test.name, ExeExt)
|
||||
var (buf, exitCode) = execCmdEx(exeFile, options = {poStdErrToStdOut, poUseShell})
|
||||
var (_, exitCode) = execCmdEx(exeFile, options = {poStdErrToStdOut, poUsePath})
|
||||
if exitCode != 0: given.err = reExitCodesDiffer
|
||||
if given.err == reSuccess: inc(r.passed)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue