Skip to content

Commit cf1124a

Browse files
authored
Merge pull request #337 from marler8997/rdmdTestVerifyDefaultCompiler
Verify default compiler in help text matches given default compiler merged-on-behalf-of: Vladimir Panteleev <[email protected]>
2 parents 15cc829 + 0aeb69a commit cf1124a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rdmd_test.d

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ void runCompilerAgnosticTests(string rdmdApp, string defaultCompiler, string mod
146146
assert(res.status == 0, res.output);
147147
assert(res.output.canFind("Usage: rdmd [RDMD AND DMD OPTIONS]... program [PROGRAM OPTIONS]..."));
148148

149+
string helpText = res.output;
150+
151+
// verify help text matches expected defaultCompiler
152+
{
153+
enum compilerHelpLine = " --compiler=comp use the specified compiler (e.g. gdmd) instead of ";
154+
auto offset = helpText.indexOf(compilerHelpLine);
155+
assert(offset >= 0);
156+
auto compilerInHelp = helpText[offset + compilerHelpLine.length .. $];
157+
compilerInHelp = compilerInHelp[0 .. compilerInHelp.indexOf('\n')];
158+
assert(defaultCompiler.baseName == compilerInHelp);
159+
}
160+
149161
// run the fallback compiler test (this involves
150162
// searching for the default compiler, so cannot
151163
// be run with other test compilers)

0 commit comments

Comments
 (0)