Skip to content

Commit

Permalink
Merge pull request #309 from kinke/fix_testsToRun
Browse files Browse the repository at this point in the history
runner: Fix ignored testsToRun regression
  • Loading branch information
atilaneves authored Jan 23, 2024
2 parents b362027 + dfbd003 commit a7315d4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions subpackages/runner/source/unit_threaded/runner/options.d
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct Options {
defaultGetoptPrinter("Usage: <progname> <options> <tests>...", helpInfo.options);
}

testsToRun = args[1 .. $];

if(random) {
if(!single) writeln("-r implies -s, running in a single thread\n");
single = true;
Expand Down
34 changes: 34 additions & 0 deletions tests/unit_threaded/ut/runner_options.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module unit_threaded.ut.runner_options;

import unit_threaded.runner.options: Options;

@("basic cmdline parsing")
unittest {
const options = Options(["ut", "-j2", "-d", "-e", "-l", "--seed", "123", "-t", "-c", "-q", "mytest1", "mytest2"]);

version(unitUnthreaded)
assert(options.numThreads == 1);
else
assert(options.numThreads == 2);
assert(options.testsToRun == ["mytest1", "mytest2"]);
assert(options.debugOutput);
assert(options.forceEscCodes);
assert(options.list);
assert(options.seed == 123);
assert(options.stackTraces);
assert(options.showChrono);
assert(options.quiet);
}

@("-s overrides -j")
unittest {
const options = Options(["ut", "-s", "-j4"]);
assert(options.numThreads == 1);
}

@("-r implies -s")
unittest {
const options = Options(["ut", "-r", "-j4"]);
assert(options.numThreads == 1);
assert(options.random);
}

0 comments on commit a7315d4

Please sign in to comment.