fix #17960: honor matrix also for action: compile, action: reject (#17980)

* fix #17960: honor `matrix` for all action
This commit is contained in:
Timothee Cour 2021-05-09 00:50:08 -07:00 • committed by GitHub
commit 69710e4548
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -478,14 +478,16 @@ proc equalModuloLastNewline(a, b: string): bool =
proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec, proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec,
target: TTarget, nimcache: string, extraOptions = "") = target: TTarget, nimcache: string, extraOptions = "") =
test.startTime = epochTime() test.startTime = epochTime()
template callNimCompilerImpl(): untyped =
# xxx this used to also pass: `--stdout --hint:Path:off`, but was done inconsistently
# with other branches
callNimCompiler(expected.getCmd, test.name, test.options, nimcache, target, extraOptions)
case expected.action case expected.action
of actionCompile: of actionCompile:
var given = callNimCompiler(expected.getCmd, test.name, test.options, nimcache, target, var given = callNimCompilerImpl()
extraOptions = " --stdout --hint[Path]:off --hint[Processing]:off")
compilerOutputTests(test, target, given, expected, r) compilerOutputTests(test, target, given, expected, r)
of actionRun: of actionRun:
var given = callNimCompiler(expected.getCmd, test.name, test.options, var given = callNimCompilerImpl()
nimcache, target, extraOptions)
if given.err != reSuccess: if given.err != reSuccess:
r.addResult(test, target, "", "$ " & given.cmd & '\n' & given.nimout, given.err) r.addResult(test, target, "", "$ " & given.cmd & '\n' & given.nimout, given.err)
else: else:
@ -538,8 +540,7 @@ proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec,
else: else:
compilerOutputTests(test, target, given, expected, r) compilerOutputTests(test, target, given, expected, r)
of actionReject: of actionReject:
var given = callNimCompiler(expected.getCmd, test.name, test.options, let given = callNimCompilerImpl()
nimcache, target)
cmpMsgs(r, expected, given, test, target) cmpMsgs(r, expected, given, test, target)
proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions = "") = proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions = "") =

View file

@ -1,10 +1,10 @@
discard """ discard """
action: reject action: reject
nimout: '''tusages.nim(22, 5) Error: 'BAD_STYLE' should be: 'BADSTYLE' [proc declared in tusages.nim(11, 6)]''' nimout: '''tusages.nim(22, 5) Error: 'BAD_STYLE' should be: 'BADSTYLE' [proc declared in tusages.nim(11, 6)]'''
cmd: "nim $target --styleCheck:error --styleCheck:usages $file" matrix: "--styleCheck:error --styleCheck:usages"
""" """
# xxx pending bug #17960, use: matrix: "--styleCheck:error --styleCheck:usages"
import strutils import strutils