mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
tester compiles again
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
line: 21
|
||||
errormsg: "invalid type: 'TTable[string, proc (string){.gcsafe.}]'"
|
||||
errormsg: "invalid type: 'Table[string, proc (string){.gcsafe.}]'"
|
||||
"""
|
||||
|
||||
import tables
|
||||
|
||||
@@ -5,7 +5,7 @@ discard """
|
||||
"""
|
||||
# test assert and exception handling
|
||||
|
||||
proc callB() = assert(False)
|
||||
proc callB() = assert(false)
|
||||
proc callA() = callB()
|
||||
proc callC() = callA()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Nimrod Tester
|
||||
# Nim Tester
|
||||
# (c) Copyright 2014 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
@@ -20,7 +20,7 @@ const
|
||||
proc delNimCache() =
|
||||
try:
|
||||
removeDir(nimcacheDir)
|
||||
except EOS:
|
||||
except OSError:
|
||||
echo "[Warning] could not delete: ", nimcacheDir
|
||||
|
||||
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) =
|
||||
try:
|
||||
copyFile(src, dest)
|
||||
except EOS:
|
||||
except OSError:
|
||||
echo "[Warning] could not copy: ", src, " to ", dest
|
||||
|
||||
proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
|
||||
@@ -236,8 +236,8 @@ let
|
||||
packageDir = babelDir / "pkgs"
|
||||
packageIndex = babelDir / "packages.json"
|
||||
|
||||
proc waitForExitEx(p: PProcess): int =
|
||||
var outp: PStream = outputStream(p)
|
||||
proc waitForExitEx(p: Process): int =
|
||||
var outp = outputStream(p)
|
||||
var line = newStringOfCap(120).TaintedString
|
||||
while true:
|
||||
if outp.readLine(line):
|
||||
@@ -250,7 +250,7 @@ proc waitForExitEx(p: PProcess): int =
|
||||
proc getPackageDir(package: string): string =
|
||||
## TODO - Replace this with dom's version comparison magic.
|
||||
var commandOutput = execCmdEx("babel path $#" % package)
|
||||
if commandOutput.exitCode != quitSuccess:
|
||||
if commandOutput.exitCode != QuitSuccess:
|
||||
return ""
|
||||
else:
|
||||
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.")
|
||||
return
|
||||
|
||||
if execCmd("$# update" % babelExe) == quitFailure:
|
||||
if execCmd("$# update" % babelExe) == QuitFailure:
|
||||
echo("[Warning] - Cannot run babel tests: Babel update failed.")
|
||||
return
|
||||
|
||||
@@ -291,7 +291,7 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
|
||||
installProcess = startProcess(babelExe, "", ["install", "-y", name])
|
||||
installStatus = waitForExitEx(installProcess)
|
||||
installProcess.close
|
||||
if installStatus != quitSuccess:
|
||||
if installStatus != QuitSuccess:
|
||||
r.addResult(test, "", "", reInstallFailed)
|
||||
continue
|
||||
|
||||
@@ -301,11 +301,11 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
|
||||
buildProcess = startProcess(babelExe, buildPath, ["build"])
|
||||
buildStatus = waitForExitEx(buildProcess)
|
||||
buildProcess.close
|
||||
if buildStatus != quitSuccess:
|
||||
if buildStatus != QuitSuccess:
|
||||
r.addResult(test, "", "", reBuildFailed)
|
||||
r.addResult(test, "", "", reSuccess)
|
||||
r.addResult(packageFileTest, "", "", reSuccess)
|
||||
except EJsonParsingError:
|
||||
except JsonParsingError:
|
||||
echo("[Warning] - Cannot run babel tests: Invalid package file.")
|
||||
r.addResult(packageFileTest, "", "", reBuildFailed)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Nimrod Tester
|
||||
# Nim Tester
|
||||
# (c) Copyright 2014 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Nimrod Tester
|
||||
# Nim Tester
|
||||
# (c) Copyright 2014 Andreas Rumpf
|
||||
#
|
||||
# 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
|
||||
if contents.find(check.peg) < 0:
|
||||
given.err = reCodegenFailure
|
||||
except EInvalidValue:
|
||||
except ValueError:
|
||||
given.err = reInvalidPeg
|
||||
except EIO:
|
||||
except IOError:
|
||||
given.err = reCodeNotFound
|
||||
|
||||
proc makeDeterministic(s: string): string =
|
||||
@@ -193,7 +193,7 @@ proc testSpec(r: var TResults, test: TTest) =
|
||||
return
|
||||
var (buf, exitCode) = execCmdEx(
|
||||
(if test.target == targetJS: "nodejs " else: "") & exeFile)
|
||||
if exitCode != expected.ExitCode:
|
||||
if exitCode != expected.exitCode:
|
||||
r.addResult(test, "exitcode: " & $expected.exitCode,
|
||||
"exitcode: " & $exitCode, reExitCodesDiffer)
|
||||
else:
|
||||
@@ -246,15 +246,15 @@ proc main() =
|
||||
if p.kind == cmdLongoption:
|
||||
case p.key.string.normalize
|
||||
of "print", "verbose": optPrintResults = true
|
||||
else: quit usage
|
||||
else: quit Usage
|
||||
p.next()
|
||||
if p.kind != cmdArgument: quit usage
|
||||
if p.kind != cmdArgument: quit Usage
|
||||
var action = p.key.string.normalize
|
||||
p.next()
|
||||
var r = initResults()
|
||||
case action
|
||||
of "all":
|
||||
let testsDir = "tests" & dirSep
|
||||
let testsDir = "tests" & DirSep
|
||||
for kind, dir in walkDir(testsDir):
|
||||
assert testsDir.startsWith(testsDir)
|
||||
let cat = dir[testsDir.len .. -1]
|
||||
@@ -272,7 +272,7 @@ proc main() =
|
||||
generateHtml(resultsFile, commit)
|
||||
generateJson(jsonFile, commit)
|
||||
else:
|
||||
quit usage
|
||||
quit Usage
|
||||
|
||||
if optPrintResults:
|
||||
if action == "html": openDefaultBrowser(resultsFile)
|
||||
@@ -280,6 +280,6 @@ proc main() =
|
||||
backend.close()
|
||||
|
||||
if paramCount() == 0:
|
||||
quit usage
|
||||
quit Usage
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user