Verify default compiler in help text matches given default compiler

This commit is contained in:
Jonathan Marler 2018-03-19 07:37:44 -06:00
parent 9a03b14dd9
commit 0aeb69a84b

View file

@ -140,6 +140,18 @@ void runCompilerAgnosticTests(string rdmdApp, string defaultCompiler, string mod
assert(res.status == 0, res.output);
assert(res.output.canFind("Usage: rdmd [RDMD AND DMD OPTIONS]... program [PROGRAM OPTIONS]..."));
string helpText = res.output;
// verify help text matches expected defaultCompiler
{
enum compilerHelpLine = " --compiler=comp use the specified compiler (e.g. gdmd) instead of ";
auto offset = helpText.indexOf(compilerHelpLine);
assert(offset >= 0);
auto compilerInHelp = helpText[offset + compilerHelpLine.length .. $];
compilerInHelp = compilerInHelp[0 .. compilerInHelp.indexOf('\n')];
assert(defaultCompiler.baseName == compilerInHelp);
}
// run the fallback compiler test (this involves
// searching for the default compiler, so cannot
// be run with other test compilers)