Don’t assume first CL arg (exe name) is present

Fixes #729
This commit is contained in:
Phil Nash 2017-03-13 11:00:58 +00:00
parent db9866677e
commit 38b05f1400
6 changed files with 66 additions and 7 deletions

View file

@ -51,10 +51,18 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
Catch::ConfigData config;
SECTION( "empty args don't cause a crash" ) {
Catch::Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();
CHECK_NOTHROW( parser.parseInto( std::vector<std::string>(), config ) );
CHECK( config.processName == "" );
}
SECTION( "default - no arguments", "" ) {
const char* argv[] = { "test" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
CHECK( config.processName == "test" );
CHECK( config.shouldDebugBreak == false );
CHECK( config.abortAfter == -1 );
CHECK( config.noThrow == false );