WIP: disallow 'nil' for strings and seqs
This commit is contained in:
parent
32afc1a562
commit
dae5450947
43 changed files with 207 additions and 173 deletions
|
|
@ -176,10 +176,7 @@ method suiteEnded*(formatter: OutputFormatter) {.base, gcsafe.} =
|
|||
discard
|
||||
|
||||
proc addOutputFormatter*(formatter: OutputFormatter) =
|
||||
if formatters == nil:
|
||||
formatters = @[formatter]
|
||||
else:
|
||||
formatters.add(formatter)
|
||||
formatters.add(formatter)
|
||||
|
||||
proc newConsoleOutputFormatter*(outputLevel: OutputLevel = PRINT_ALL,
|
||||
colorOutput = true): ConsoleOutputFormatter =
|
||||
|
|
@ -225,7 +222,7 @@ method testStarted*(formatter: ConsoleOutputFormatter, testName: string) =
|
|||
formatter.isInTest = true
|
||||
|
||||
method failureOccurred*(formatter: ConsoleOutputFormatter, checkpoints: seq[string], stackTrace: string) =
|
||||
if stackTrace != nil:
|
||||
if stackTrace.len > 0:
|
||||
echo stackTrace
|
||||
let prefix = if formatter.isInSuite: " " else: ""
|
||||
for msg in items(checkpoints):
|
||||
|
|
@ -236,7 +233,7 @@ method testEnded*(formatter: ConsoleOutputFormatter, testResult: TestResult) =
|
|||
|
||||
if formatter.outputLevel != PRINT_NONE and
|
||||
(formatter.outputLevel == PRINT_ALL or testResult.status == FAILED):
|
||||
let prefix = if testResult.suiteName != nil: " " else: ""
|
||||
let prefix = if testResult.suiteName.len > 0: " " else: ""
|
||||
template rawPrint() = echo(prefix, "[", $testResult.status, "] ", testResult.testName)
|
||||
when not defined(ECMAScript):
|
||||
if formatter.colorOutput and not defined(ECMAScript):
|
||||
|
|
@ -301,7 +298,7 @@ method failureOccurred*(formatter: JUnitOutputFormatter, checkpoints: seq[string
|
|||
## ``stackTrace`` is provided only if the failure occurred due to an exception.
|
||||
## ``checkpoints`` is never ``nil``.
|
||||
formatter.testErrors.add(checkpoints)
|
||||
if stackTrace != nil:
|
||||
if stackTrace.len > 0:
|
||||
formatter.testStackTrace = stackTrace
|
||||
|
||||
method testEnded*(formatter: JUnitOutputFormatter, testResult: TestResult) =
|
||||
|
|
@ -392,7 +389,7 @@ proc shouldRun(currentSuiteName, testName: string): bool =
|
|||
return false
|
||||
|
||||
proc ensureInitialized() =
|
||||
if formatters == nil:
|
||||
if formatters.len == 0:
|
||||
formatters = @[OutputFormatter(defaultConsoleFormatter())]
|
||||
|
||||
if not disabledParamFiltering and not testsFilters.isValid:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue