[backport] Fix style issues in lib/, tools/, and testament/. Fixes #12687. (#12754)

(cherry picked from commit 0944b0f441)
This commit is contained in:
3n-k1
2019-11-28 02:32:11 -05:00
committed by narimiran
parent 10935a71ed
commit a02a4d8fc5
9 changed files with 106 additions and 106 deletions

View File

@@ -23,8 +23,8 @@ var
proc getMachine*(): MachineId =
var name = execProcess("hostname").string.strip
if name.len == 0:
name = when defined(posix): getenv("HOSTNAME").string
else: getenv("COMPUTERNAME").string
name = when defined(posix): getEnv("HOSTNAME").string
else: getEnv("COMPUTERNAME").string
if name.len == 0:
quit "cannot determine the machine name"

View File

@@ -295,7 +295,7 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
testSpec r, makeTest(filename, options, cat), {targetJS}
template testCPP(filename: untyped) =
testSpec r, makeTest(filename, options, cat), {targetCPP}
testSpec r, makeTest(filename, options, cat), {targetCpp}
let tests = [
"niminaction/Chapter1/various1",
@@ -378,7 +378,7 @@ proc findMainFile(dir: string): string =
elif file.endsWith(".nim"):
if result.len == 0: result = file
inc nimFiles
if nimFiles != 1: result.setlen(0)
if nimFiles != 1: result.setLen(0)
proc manyLoc(r: var TResults, cat: Category, options: string) =
for kind, dir in os.walkDir("tests/manyloc"):
@@ -530,7 +530,7 @@ const MegaTestCat = "megatest"
proc `&.?`(a, b: string): string =
# candidate for the stdlib?
result = if b.startswith(a): b else: a & b
result = if b.startsWith(a): b else: a & b
proc processSingleTest(r: var TResults, cat: Category, options, test: string) =
let test = testsDir &.? cat.string / test

View File

@@ -63,7 +63,7 @@ proc generateTestResultPanelPartial(outfile: File, testResultRow: JsonNode) =
type
AllTests = object
data: JSonNode
data: JsonNode
totalCount, successCount, ignoredCount, failedCount: int
successPercentage, ignoredPercentage, failedPercentage: BiggestFloat

View File

@@ -90,7 +90,7 @@ proc getFileDir(filename: string): string =
if not result.isAbsolute():
result = getCurrentDir() / result
proc execCmdEx2(command: string, args: openarray[string]; workingDir, input: string = ""): tuple[
proc execCmdEx2(command: string, args: openArray[string]; workingDir, input: string = ""): tuple[
cmdLine: string,
output: TaintedString,
exitCode: int] {.tags:
@@ -465,7 +465,7 @@ proc testSpecHelper(r: var TResults, test: TTest, expected: TSpec, target: TTarg
if exitCode != expected.exitCode:
r.addResult(test, target, "exitcode: " & $expected.exitCode,
"exitcode: " & $exitCode & "\n\nOutput:\n" &
bufB, reExitCodesDiffer)
bufB, reExitcodesDiffer)
elif (expected.outputCheck == ocEqual and expected.output != bufB) or
(expected.outputCheck == ocSubstr and expected.output notin bufB):
given.err = reOutputsDiffer
@@ -522,7 +522,7 @@ proc testC(r: var TResults, test: TTest, action: TTestAction) =
elif action == actionRun:
let exeFile = changeFileExt(test.name, ExeExt)
var (_, exitCode) = execCmdEx(exeFile, options = {poStdErrToStdOut, poUsePath})
if exitCode != 0: given.err = reExitCodesDiffer
if exitCode != 0: given.err = reExitcodesDiffer
if given.err == reSuccess: inc(r.passed)
proc testExec(r: var TResults, test: TTest) =
@@ -535,7 +535,7 @@ proc testExec(r: var TResults, test: TTest) =
if errC == 0:
given.err = reSuccess
else:
given.err = reExitCodesDiffer
given.err = reExitcodesDiffer
given.msg = outp.string
if given.err == reSuccess: inc(r.passed)
@@ -595,8 +595,8 @@ proc loadSkipFrom(name: string): seq[string] =
result.add sline
proc main() =
os.putenv "NIMTEST_COLOR", "never"
os.putenv "NIMTEST_OUTPUT_LVL", "PRINT_FAILURES"
os.putEnv "NIMTEST_COLOR", "never"
os.putEnv "NIMTEST_OUTPUT_LVL", "PRINT_FAILURES"
backend.open()
var optPrintResults = false
@@ -608,7 +608,7 @@ proc main() =
var p = initOptParser()
p.next()
while p.kind in {cmdLongoption, cmdShortOption}:
while p.kind in {cmdLongOption, cmdShortOption}:
case p.key.string.normalize
of "print", "verbose": optPrintResults = true
of "failing": optFailing = true