mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
[bugfix] Make std/unittest compile with --styleCheck:error (#11762)
This commit is contained in:
@@ -190,7 +190,7 @@ proc defaultConsoleFormatter*(): <//>ConsoleOutputFormatter =
|
||||
var envOutLvl = os.getEnv("NIMTEST_OUTPUT_LVL").string
|
||||
var colorOutput = isatty(stdout)
|
||||
if existsEnv("NIMTEST_COLOR"):
|
||||
let colorEnv = getenv("NIMTEST_COLOR")
|
||||
let colorEnv = getEnv("NIMTEST_COLOR")
|
||||
if colorEnv == "never":
|
||||
colorOutput = false
|
||||
elif colorEnv == "always":
|
||||
@@ -349,7 +349,7 @@ proc glob(matcher, filter: string): bool =
|
||||
let beforeAndAfter = filter.split('*', maxsplit=1)
|
||||
if beforeAndAfter.len == 1:
|
||||
# "foo*"
|
||||
return matcher.startswith(beforeAndAfter[0])
|
||||
return matcher.startsWith(beforeAndAfter[0])
|
||||
|
||||
if matcher.len < filter.len - 1:
|
||||
return false # "12345" should not match "123*345"
|
||||
@@ -366,8 +366,8 @@ proc matchFilter(suiteName, testName, filter: string): bool =
|
||||
|
||||
if suiteAndTestFilters.len == 1:
|
||||
# no suite specified
|
||||
let test_f = suiteAndTestFilters[0]
|
||||
return glob(testName, test_f)
|
||||
let testFilter = suiteAndTestFilters[0]
|
||||
return glob(testName, testFilter)
|
||||
|
||||
return glob(suiteName, suiteAndTestFilters[0]) and glob(testName, suiteAndTestFilters[1])
|
||||
|
||||
@@ -627,7 +627,7 @@ macro check*(conditions: untyped): untyped =
|
||||
# Ident !"v"
|
||||
# IntLit 2
|
||||
result.check[i] = exp[i][1]
|
||||
if exp[i].typekind notin {ntyTypeDesc}:
|
||||
if exp[i].typeKind notin {ntyTypeDesc}:
|
||||
let arg = newIdentNode(":p" & $counter)
|
||||
result.assigns.add getAst(asgn(arg, paramAst))
|
||||
result.printOuts.add getAst(print(argStr, arg))
|
||||
@@ -640,7 +640,7 @@ macro check*(conditions: untyped): untyped =
|
||||
of nnkCallKinds:
|
||||
|
||||
let (assigns, check, printOuts) = inspectArgs(checked)
|
||||
let lineinfo = newStrLitNode(checked.lineinfo)
|
||||
let lineinfo = newStrLitNode(checked.lineInfo)
|
||||
let callLit = checked.toStrLit
|
||||
result = quote do:
|
||||
block:
|
||||
@@ -657,7 +657,7 @@ macro check*(conditions: untyped): untyped =
|
||||
result.add(newCall(!"check", node))
|
||||
|
||||
else:
|
||||
let lineinfo = newStrLitNode(checked.lineinfo)
|
||||
let lineinfo = newStrLitNode(checked.lineInfo)
|
||||
let callLit = checked.toStrLit
|
||||
|
||||
result = quote do:
|
||||
@@ -712,7 +712,7 @@ macro expect*(exceptions: varargs[typed], body: untyped): untyped =
|
||||
for i in countup(1, exp.len - 2):
|
||||
errorTypes.add(exp[i])
|
||||
|
||||
result = getAst(expectBody(errorTypes, exp.lineinfo, body))
|
||||
result = getAst(expectBody(errorTypes, exp.lineInfo, body))
|
||||
|
||||
proc disableParamFiltering* =
|
||||
## disables filtering tests with the command line params
|
||||
|
||||
Reference in New Issue
Block a user