ability to run just one test case, finally

This commit is contained in:
2021-10-14 18:17:17 -04:00
parent 13b0639e8a
commit 858cfba33f
2 changed files with 26 additions and 2 deletions

View File

@@ -2,12 +2,32 @@ package test;
import utest.Runner;
import utest.ui.Report;
#if macro
import haxe.macro.Context;
#end
class TestMain {
public static function main() {
var runner = new Runner();
runner.addCases(test.cases);
addCases();
Report.create(runner);
runner.run();
}
static macro function addCases() {
if (Context.defined("cases")) {
var cases = Context.definedValue("cases").split(",");
var block = [];
for (caseName in cases) {
var typePath = {
pack: ["test", "cases"],
name: caseName
};
block.push(macro runner.addCase(new $typePath()));
}
return macro $b{block};
} else {
return macro runner.addCases(test.cases);
}
}
}