test application: Allow to skip argument parsing
This commit is contained in:
parent
39f69f94d7
commit
cc5d6052f5
|
@ -67,30 +67,32 @@ TestApplication::TestApplication(int argc, char **argv)
|
||||||
readFallbackTestfilePathFromSrcRef();
|
readFallbackTestfilePathFromSrcRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup argument parser
|
// handle specified arguments (if present)
|
||||||
for (Argument *arg : initializer_list<Argument *>{ &m_testFilesPathArg, &m_applicationPathArg, &m_workingDirArg }) {
|
if (argc && argv) {
|
||||||
arg->setRequiredValueCount(1);
|
// setup argument parser
|
||||||
arg->setValueNames({ "path" });
|
for (Argument *arg : initializer_list<Argument *>{ &m_testFilesPathArg, &m_applicationPathArg, &m_workingDirArg }) {
|
||||||
arg->setCombinable(true);
|
arg->setRequiredValueCount(1);
|
||||||
}
|
arg->setValueNames({ "path" });
|
||||||
m_unitsArg.setRequiredValueCount(Argument::varValueCount);
|
arg->setCombinable(true);
|
||||||
m_unitsArg.setValueNames({ "unit1", "unit2", "unit3" });
|
}
|
||||||
m_unitsArg.setCombinable(true);
|
m_unitsArg.setRequiredValueCount(Argument::varValueCount);
|
||||||
m_parser.setMainArguments({ &m_testFilesPathArg, &m_applicationPathArg, &m_workingDirArg, &m_unitsArg, &m_helpArg });
|
m_unitsArg.setValueNames({ "unit1", "unit2", "unit3" });
|
||||||
|
m_unitsArg.setCombinable(true);
|
||||||
|
m_parser.setMainArguments({ &m_testFilesPathArg, &m_applicationPathArg, &m_workingDirArg, &m_unitsArg, &m_helpArg });
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
try {
|
try {
|
||||||
m_parser.parseArgs(argc, argv);
|
m_parser.parseArgs(argc, argv);
|
||||||
} catch (const Failure &failure) {
|
} catch (const Failure &failure) {
|
||||||
cerr << failure;
|
cerr << failure;
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print help
|
// print help
|
||||||
if (m_helpArg.isPresent()) {
|
if (m_helpArg.isPresent()) {
|
||||||
m_valid = false;
|
exit(0);
|
||||||
exit(0);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle path for testfiles and working-copy
|
// handle path for testfiles and working-copy
|
||||||
|
|
Loading…
Reference in New Issue