diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-05-14 17:33:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-14 11:33:08 +0200 |
commit | 04f3df4c87e8ba9efc26fa4faed8e3b6cbaa6e93 (patch) | |
tree | f55404996ef69a90839ce572bf1fb519c51bf2d4 /testament | |
parent | 81a937ce1f23e443a2b60375a0961bafa5b8bd06 (diff) | |
download | Nim-04f3df4c87e8ba9efc26fa4faed8e3b6cbaa6e93.tar.gz |
fixes testament matrix doesn't work with other backends which left many JS tests untested (#23592)
Targets are not changes, which means the C binary is actually tested for JS backend
Diffstat (limited to 'testament')
-rw-r--r-- | testament/testament.nim | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/testament/testament.nim b/testament/testament.nim index e0a200e29..1e892e636 100644 --- a/testament/testament.nim +++ b/testament/testament.nim @@ -10,9 +10,12 @@ ## This program verifies Nim against the testcases. import - strutils, pegs, os, osproc, streams, json, std/exitprocs, - backend, parseopt, specs, htmlgen, browsers, terminal, - algorithm, times, azure, intsets, macros + std/[strutils, pegs, os, osproc, streams, json, + parseopt, browsers, terminal, exitprocs, + algorithm, times, intsets, macros] + +import backend, specs, azure, htmlgen + from std/sugar import dup import compiler/nodejs import lib/stdtest/testutils @@ -528,6 +531,23 @@ proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec, "exitcode: " & $given.exitCode & "\n\nOutput:\n" & given.nimout, reExitcodesDiffer) + + +proc changeTarget(extraOptions: string; defaultTarget: TTarget): TTarget = + result = defaultTarget + var p = parseopt.initOptParser(extraOptions) + + while true: + parseopt.next(p) + case p.kind + of cmdEnd: break + of cmdLongOption, cmdShortOption: + if p.key == "b" or p.key == "backend": + result = parseEnum[TTarget](p.val.normalize) + # chooses the last one + else: + discard + proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions: string) = for target in expected.targets: inc(r.total) @@ -540,6 +560,7 @@ proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions: s else: let nimcache = nimcacheDir(test.name, test.options, target) var testClone = test + let target = changeTarget(extraOptions, target) testSpecHelper(r, testClone, expected, target, extraOptions, nimcache) proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) = |