diff --git a/docs/own-main.md b/docs/own-main.md index 23f472e2..b1f3269f 100644 --- a/docs/own-main.md +++ b/docs/own-main.md @@ -39,34 +39,20 @@ If you still want Catch to process the command line, but you want to programatic int main( int argc, char* argv[] ) { Catch::Session session; // There must be exactly one instance - + // writing to session.configData() here sets defaults // this is the preferred way to set them - - // Verify that all tests, aliases, etc registered properly - const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); - if ( !exceptions.empty() ) { - // iterate over all exceptions and notify user - for ( const auto& ex_ptr : exceptions ) { - try { - std::rethrow_exception(ex_ptr); - } catch (std::exception const& ex) { - Catch::cerr() << ex.what(); - } - } - // Indicate that an error occured before main - return 1; - } - + int returnCode = session.applyCommandLine( argc, argv ); if( returnCode != 0 ) // Indicates a command line error - return returnCode; - + return returnCode; + // writing to session.configData() or session.Config() here // overrides command line args // only do this if you know you need to int numFailed = session.run(); + // numFailed is clamped to 255 as some unices only use the lower 8 bits. // This clamping has already been applied, so just return it here // You can also do any post run clean-up here