diff options
author | Araq <rumpf_a@web.de> | 2015-10-13 14:10:33 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-10-13 14:10:33 +0200 |
commit | 8be9e4640320ddc4c11cf433fb6e232a743a9700 (patch) | |
tree | 84b223decfbfe5ed5104682dd4fd62a4f274398a /tests | |
parent | 2fda95a4d630aa8b293f16e4f21471f7ee8e743a (diff) | |
download | Nim-8be9e4640320ddc4c11cf433fb6e232a743a9700.tar.gz |
udpated the compiler and tester to use getOrDefault
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testament/backend.nim | 6 | ||||
-rw-r--r-- | tests/testament/htmlgen.nim | 2 | ||||
-rw-r--r-- | tests/testament/tester.nim | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim index e2e2e2dd5..9ec0c0973 100644 --- a/tests/testament/backend.nim +++ b/tests/testament/backend.nim @@ -8,7 +8,7 @@ import strutils, db_sqlite, os, osproc -var db: TDbConn +var db: DbConn proc createDb() = db.exec(sql""" @@ -61,7 +61,7 @@ var proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip -proc getMachine*(db: TDbConn): MachineId = +proc getMachine*(db: DbConn): MachineId = var name = "hostname"() if name.len == 0: name = when defined(posix): getenv"HOSTNAME".string @@ -76,7 +76,7 @@ proc getMachine*(db: TDbConn): MachineId = result = db.insertId(sql"insert into Machine(name, os, cpu) values (?,?,?)", name, system.hostOS, system.hostCPU).MachineId -proc getCommit(db: TDbConn): CommitId = +proc getCommit(db: DbConn): CommitId = const commLen = "commit ".len let hash = "git log -n 1"()[commLen..commLen+10] let branch = "git symbolic-ref --short HEAD"() diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim index 98ccf1170..15960f09a 100644 --- a/tests/testament/htmlgen.nim +++ b/tests/testament/htmlgen.nim @@ -109,7 +109,7 @@ div.tabContent.hide { display: none; } proc td(s: string): string = result = "<td>" & s.substr(0, 200).xmlEncode & "</td>" -proc getCommit(db: TDbConn, c: int): string = +proc getCommit(db: DbConn, c: int): string = var commit = c for thisCommit in db.rows(sql"select id from [Commit] order by id desc"): if commit == 0: result = thisCommit[0] diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 636093a7f..ae8735ebe 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -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) |