Reorganised CLI again in another attempt to get past VS ICEs

This commit is contained in:
Phil Nash 2017-06-21 11:42:53 +01:00
parent e0c6c4aee7
commit 3bb16e8418

View File

@ -74,82 +74,77 @@ namespace Catch {
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
}; };
auto cli1 auto cli
= ExeName( config.processName ) = ExeName( config.processName )
+ Help( config.showHelp ) + Help( config.showHelp );
+ Opt( config.listTests )
cli += Opt( config.listTests )
["-l"]["--list-tests"] ["-l"]["--list-tests"]
( "list all/matching test cases" ) ( "list all/matching test cases" );
+ Opt( config.listTags ) cli += Opt( config.listTags )
["-t"]["--list-tags"] ["-t"]["--list-tags"]
( "list all/matching tags" ) ( "list all/matching tags" );
+ Opt( config.showSuccessfulTests ) cli += Opt( config.showSuccessfulTests )
["-s"]["--success"] ["-s"]["--success"]
( "include successful tests in output" ) ( "include successful tests in output" );
+ Opt( config.shouldDebugBreak ) cli += Opt( config.shouldDebugBreak )
["-b"]["--break"] ["-b"]["--break"]
( "break into debugger on failure" ) ( "break into debugger on failure" );
+ Opt( config.noThrow ) cli += Opt( config.noThrow )
["-e"]["--nothrow"] ["-e"]["--nothrow"]
( "skip exception tests" ) ( "skip exception tests" );
+ Opt( config.showInvisibles ) cli += Opt( config.showInvisibles )
["-i"]["--invisibles"] ["-i"]["--invisibles"]
( "show invisibles (tabs, newlines)" ); ( "show invisibles (tabs, newlines)" );
cli += Opt( config.outputFilename, "filename" )
auto cli2
= Opt( config.outputFilename, "filename" )
["-o"]["--out"] ["-o"]["--out"]
( "output filename" ) ( "output filename" );
+ Opt( config.reporterNames, "name" ) cli += Opt( config.reporterNames, "name" )
["-r"]["--reporter"] ["-r"]["--reporter"]
( "reporter to use (defaults to console)" ) ( "reporter to use (defaults to console)" );
+ Opt( config.name, "name" ) cli += Opt( config.name, "name" )
["-n"]["--name"] ["-n"]["--name"]
( "suite name" ) ( "suite name" );
+ Opt( [&]( bool ){ config.abortAfter = 1; } ) cli += Opt( [&]( bool ){ config.abortAfter = 1; } )
["-a"]["--abort"] ["-a"]["--abort"]
( "abort at first failure" ) ( "abort at first failure" );
+ Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) cli += Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
["-x"]["--abortx"] ["-x"]["--abortx"]
( "abort after x failures" ) ( "abort after x failures" );
+ Opt( setWarning, "warning name" ) cli += Opt( setWarning, "warning name" )
["-w"]["--warn"] ["-w"]["--warn"]
( "enable warnings" ) ( "enable warnings" );
+ Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } ) cli += Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
["-d"]["--durations"] ["-d"]["--durations"]
( "show test durations" ) ( "show test durations" );
+ Opt( loadTestNamesFromFile, "filename" ) cli += Opt( loadTestNamesFromFile, "filename" )
["-f"]["--input-file"] ["-f"]["--input-file"]
( "load test names to run from a file" ); ( "load test names to run from a file" );
cli += Opt( config.filenamesAsTags )
auto cli3
= Opt( config.filenamesAsTags )
["-#"]["--filenames-as-tags"] ["-#"]["--filenames-as-tags"]
( "adds a tag for the filename" ) ( "adds a tag for the filename" );
+ Opt( config.sectionsToRun, "section name" ) cli += Opt( config.sectionsToRun, "section name" )
["-c"]["--section"] ["-c"]["--section"]
( "specify section to run" ) ( "specify section to run" );
+ Opt( config.listTestNamesOnly ) cli += Opt( config.listTestNamesOnly )
["--list-test-names-only"] ["--list-test-names-only"]
( "list all/matching test cases names only" ) ( "list all/matching test cases names only" );
+ Opt( config.listReporters ) cli += Opt( config.listReporters )
["--list-reporters"] ["--list-reporters"]
( "list all reporters" ) ( "list all reporters" );
+ Opt( setTestOrder, "decl|lex|rand" ) cli += Opt( setTestOrder, "decl|lex|rand" )
["--order"] ["--order"]
( "test case order (defaults to decl)" ) ( "test case order (defaults to decl)" );
+ Opt( setRngSeed, "'time'|number" ) cli += Opt( setRngSeed, "'time'|number" )
["--rng-seed"] ["--rng-seed"]
( "set a specific seed for random numbers" ) ( "set a specific seed for random numbers" );
+ Opt( setColourUsage, "yes|no" ) cli += Opt( setColourUsage, "yes|no" )
["--use-colour"] ["--use-colour"]
( "should output be colourised" ) ( "should output be colourised" );
cli += Arg( config.testsOrTags, "test name|pattern|tags" )
+ Arg( config.testsOrTags, "test name|pattern|tags" )
( "which test or tests to use" ); ( "which test or tests to use" );
// Assemble from smaller parsers because some VS versions give ICEs otherwise return cli;
return cli1 + cli2 + cli3;
} }
} // end namespace Catch } // end namespace Catch