tester compiles again

This commit is contained in:
Araq 2014-08-29 01:12:18 +02:00
commit 6713ebcd98
5 changed files with 22 additions and 22 deletions

View file

@ -1,6 +1,6 @@
discard """ discard """
line: 21 line: 21
errormsg: "invalid type: 'TTable[string, proc (string){.gcsafe.}]'" errormsg: "invalid type: 'Table[string, proc (string){.gcsafe.}]'"
""" """
import tables import tables

View file

@ -5,7 +5,7 @@ discard """
""" """
# test assert and exception handling # test assert and exception handling
proc callB() = assert(False) proc callB() = assert(false)
proc callA() = callB() proc callA() = callB()
proc callC() = callA() proc callC() = callA()

View file

@ -1,6 +1,6 @@
# #
# #
# Nimrod Tester # Nim Tester
# (c) Copyright 2014 Andreas Rumpf # (c) Copyright 2014 Andreas Rumpf
# #
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
@ -20,7 +20,7 @@ const
proc delNimCache() = proc delNimCache() =
try: try:
removeDir(nimcacheDir) removeDir(nimcacheDir)
except EOS: except OSError:
echo "[Warning] could not delete: ", nimcacheDir echo "[Warning] could not delete: ", nimcacheDir
proc runRodFiles(r: var TResults, cat: Category, options: string) = proc runRodFiles(r: var TResults, cat: Category, options: string) =
@ -71,7 +71,7 @@ proc compileRodFiles(r: var TResults, cat: Category, options: string) =
proc safeCopyFile(src, dest: string) = proc safeCopyFile(src, dest: string) =
try: try:
copyFile(src, dest) copyFile(src, dest)
except EOS: except OSError:
echo "[Warning] could not copy: ", src, " to ", dest echo "[Warning] could not copy: ", src, " to ", dest
proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) = proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
@ -236,8 +236,8 @@ let
packageDir = babelDir / "pkgs" packageDir = babelDir / "pkgs"
packageIndex = babelDir / "packages.json" packageIndex = babelDir / "packages.json"
proc waitForExitEx(p: PProcess): int = proc waitForExitEx(p: Process): int =
var outp: PStream = outputStream(p) var outp = outputStream(p)
var line = newStringOfCap(120).TaintedString var line = newStringOfCap(120).TaintedString
while true: while true:
if outp.readLine(line): if outp.readLine(line):
@ -250,7 +250,7 @@ proc waitForExitEx(p: PProcess): int =
proc getPackageDir(package: string): string = proc getPackageDir(package: string): string =
## TODO - Replace this with dom's version comparison magic. ## TODO - Replace this with dom's version comparison magic.
var commandOutput = execCmdEx("babel path $#" % package) var commandOutput = execCmdEx("babel path $#" % package)
if commandOutput.exitCode != quitSuccess: if commandOutput.exitCode != QuitSuccess:
return "" return ""
else: else:
result = commandOutput[0].string result = commandOutput[0].string
@ -278,7 +278,7 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
echo("[Warning] - Cannot run babel tests: Babel binary not found.") echo("[Warning] - Cannot run babel tests: Babel binary not found.")
return return
if execCmd("$# update" % babelExe) == quitFailure: if execCmd("$# update" % babelExe) == QuitFailure:
echo("[Warning] - Cannot run babel tests: Babel update failed.") echo("[Warning] - Cannot run babel tests: Babel update failed.")
return return
@ -291,7 +291,7 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
installProcess = startProcess(babelExe, "", ["install", "-y", name]) installProcess = startProcess(babelExe, "", ["install", "-y", name])
installStatus = waitForExitEx(installProcess) installStatus = waitForExitEx(installProcess)
installProcess.close installProcess.close
if installStatus != quitSuccess: if installStatus != QuitSuccess:
r.addResult(test, "", "", reInstallFailed) r.addResult(test, "", "", reInstallFailed)
continue continue
@ -301,11 +301,11 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
buildProcess = startProcess(babelExe, buildPath, ["build"]) buildProcess = startProcess(babelExe, buildPath, ["build"])
buildStatus = waitForExitEx(buildProcess) buildStatus = waitForExitEx(buildProcess)
buildProcess.close buildProcess.close
if buildStatus != quitSuccess: if buildStatus != QuitSuccess:
r.addResult(test, "", "", reBuildFailed) r.addResult(test, "", "", reBuildFailed)
r.addResult(test, "", "", reSuccess) r.addResult(test, "", "", reSuccess)
r.addResult(packageFileTest, "", "", reSuccess) r.addResult(packageFileTest, "", "", reSuccess)
except EJsonParsingError: except JsonParsingError:
echo("[Warning] - Cannot run babel tests: Invalid package file.") echo("[Warning] - Cannot run babel tests: Invalid package file.")
r.addResult(packageFileTest, "", "", reBuildFailed) r.addResult(packageFileTest, "", "", reBuildFailed)

View file

@ -1,6 +1,6 @@
# #
# #
# Nimrod Tester # Nim Tester
# (c) Copyright 2014 Andreas Rumpf # (c) Copyright 2014 Andreas Rumpf
# #
# See the file "copying.txt", included in this # See the file "copying.txt", included in this

View file

@ -1,6 +1,6 @@
# #
# #
# Nimrod Tester # Nim Tester
# (c) Copyright 2014 Andreas Rumpf # (c) Copyright 2014 Andreas Rumpf
# #
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
@ -146,9 +146,9 @@ proc codegenCheck(test: TTest, check: string, given: var TSpec) =
let contents = readFile(genFile).string let contents = readFile(genFile).string
if contents.find(check.peg) < 0: if contents.find(check.peg) < 0:
given.err = reCodegenFailure given.err = reCodegenFailure
except EInvalidValue: except ValueError:
given.err = reInvalidPeg given.err = reInvalidPeg
except EIO: except IOError:
given.err = reCodeNotFound given.err = reCodeNotFound
proc makeDeterministic(s: string): string = proc makeDeterministic(s: string): string =
@ -193,7 +193,7 @@ proc testSpec(r: var TResults, test: TTest) =
return return
var (buf, exitCode) = execCmdEx( var (buf, exitCode) = execCmdEx(
(if test.target == targetJS: "nodejs " else: "") & exeFile) (if test.target == targetJS: "nodejs " else: "") & exeFile)
if exitCode != expected.ExitCode: if exitCode != expected.exitCode:
r.addResult(test, "exitcode: " & $expected.exitCode, r.addResult(test, "exitcode: " & $expected.exitCode,
"exitcode: " & $exitCode, reExitCodesDiffer) "exitcode: " & $exitCode, reExitCodesDiffer)
else: else:
@ -246,15 +246,15 @@ proc main() =
if p.kind == cmdLongoption: if p.kind == cmdLongoption:
case p.key.string.normalize case p.key.string.normalize
of "print", "verbose": optPrintResults = true of "print", "verbose": optPrintResults = true
else: quit usage else: quit Usage
p.next() p.next()
if p.kind != cmdArgument: quit usage if p.kind != cmdArgument: quit Usage
var action = p.key.string.normalize var action = p.key.string.normalize
p.next() p.next()
var r = initResults() var r = initResults()
case action case action
of "all": of "all":
let testsDir = "tests" & dirSep let testsDir = "tests" & DirSep
for kind, dir in walkDir(testsDir): for kind, dir in walkDir(testsDir):
assert testsDir.startsWith(testsDir) assert testsDir.startsWith(testsDir)
let cat = dir[testsDir.len .. -1] let cat = dir[testsDir.len .. -1]
@ -272,7 +272,7 @@ proc main() =
generateHtml(resultsFile, commit) generateHtml(resultsFile, commit)
generateJson(jsonFile, commit) generateJson(jsonFile, commit)
else: else:
quit usage quit Usage
if optPrintResults: if optPrintResults:
if action == "html": openDefaultBrowser(resultsFile) if action == "html": openDefaultBrowser(resultsFile)
@ -280,6 +280,6 @@ proc main() =
backend.close() backend.close()
if paramCount() == 0: if paramCount() == 0:
quit usage quit Usage
main() main()