Skip to content

Commit ad8bbbe

Browse files
committed
Move findExamples in a separate lambda
1 parent 3868484 commit ad8bbbe

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

dspec_tester.d

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,18 @@ int main(string[] args)
110110
}
111111

112112
// Find all examples in the specification
113+
alias findExamples = (file, ddocKey) => file
114+
.readText
115+
.findDdocMacro(ddocKey)
116+
.map!ddocMacroToCode;
117+
118+
enum ddocKey = "$(SPEC_RUNNABLE_EXAMPLE";
119+
113120
foreach (file; specDir.dirEntries("*.dd", SpanMode.depth).parallel(1))
114121
{
115122
import std.uni : isWhite;
116-
auto allTests =
117-
file
118-
.readText
119-
.findDdocMacro("$(SPEC_RUNNABLE_EXAMPLE")
120-
.map!ddocMacroToCode
121-
.map!compileAndCheck;
122123

124+
auto allTests = findExamples(file, ddocKey).map!compileAndCheck;
123125
if (!allTests.empty)
124126
{
125127
writefln("%s: %d examples found", file.baseName, allTests.walkLength);

0 commit comments

Comments
 (0)