@@ -71,14 +71,24 @@ unittest
71
71
assert (" aa $(foo $(bar)foobar)" .untilClosingParentheses.equal(" aa $(foo $(bar)foobar)" ));
72
72
}
73
73
74
- auto findDdocMacro (string text, string ddocKey)
74
+ auto findDdocMacro (R)(R text, string ddocKey)
75
75
{
76
76
return text.splitter(ddocKey).map! untilClosingParentheses.dropOne;
77
77
}
78
78
79
+ auto ddocMacroToCode (R)(R text)
80
+ {
81
+ import std.ascii : newline;
82
+ import std.conv : to;
83
+ return text.find(" ---" )
84
+ .findSplitAfter(newline)[1 ]
85
+ .findSplitBefore(" ---" )[0 ]
86
+ .to! string ;
87
+ }
88
+
79
89
int main (string [] args)
80
90
{
81
- import std.conv , std. file , std.getopt , std.path ;
91
+ import std.file , std.getopt , std.path ;
82
92
import std.parallelism : parallel;
83
93
import std.process : environment;
84
94
@@ -102,17 +112,12 @@ int main(string[] args)
102
112
// Find all examples in the specification
103
113
foreach (file; specDir.dirEntries(" *.dd" , SpanMode.depth).parallel(1 ))
104
114
{
105
- import std.ascii : newline;
106
115
import std.uni : isWhite;
107
116
auto allTests =
108
117
file
109
118
.readText
110
119
.findDdocMacro(" $(SPEC_RUNNABLE_EXAMPLE" )
111
- .map! (a => a
112
- .find(" ---" )
113
- .findSplitAfter(newline)[1 ]
114
- .findSplitBefore(" ---" )[0 ]
115
- .to! string )
120
+ .map! ddocMacroToCode
116
121
.map! compileAndCheck;
117
122
118
123
if (! allTests.empty)
0 commit comments