Skip to content

Commit fd423bc

Browse files
committed
Use multiple spec types
1 parent 5cba617 commit fd423bc

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dspec_tester.d

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ int main(string[] args)
9191
import std.file, std.getopt, std.path;
9292
import std.parallelism : parallel;
9393
import std.process : environment;
94+
import std.typecons : Tuple;
9495

9596
auto specDir = __FILE_FULL_PATH__.dirName.buildPath("spec");
9697
config.dmdBinPath = environment.get("DMD", "dmd");
@@ -115,12 +116,17 @@ int main(string[] args)
115116
.findDdocMacro(ddocKey)
116117
.map!ddocMacroToCode;
117118

118-
enum ddocKey = "$(SPEC_RUNNABLE_EXAMPLE";
119-
119+
alias SpecType = Tuple!(string, "key", CompileConfig.TestMode, "mode");
120+
auto specTypes = [
121+
SpecType("$(SPEC_RUNNABLE_EXAMPLE", CompileConfig.TestMode.compile),
122+
SpecType("$(SPEC_RUNNABLE_EXAMPLE_RUN", CompileConfig.TestMode.run),
123+
SpecType("$(SPEC_RUNNABLE_EXAMPLE_FAIL", CompileConfig.TestMode.fail),
124+
];
120125
foreach (file; specDir.dirEntries("*.dd", SpanMode.depth).parallel(1))
121126
{
122-
CompileConfig compileConfig = {mode: CompileConfig.TestMode.compile};
123-
auto allTests = findExamples(file, ddocKey).map!(e => compileAndCheck(e, compileConfig));
127+
auto allTests = specTypes.map!(c => findExamples(file, c.key)
128+
.map!(e => compileAndCheck(e, CompileConfig(c.mode))))
129+
.joiner;
124130
if (!allTests.empty)
125131
{
126132
writefln("%s: %d examples found", file.baseName, allTests.walkLength);

0 commit comments

Comments
 (0)