mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Removed handling of start-up exceptions from custom main docs
This commit is contained in:
parent
fe05062f9e
commit
8b40c26434
@ -43,30 +43,16 @@ int main( int argc, char* argv[] )
|
|||||||
// writing to session.configData() here sets defaults
|
// writing to session.configData() here sets defaults
|
||||||
// this is the preferred way to set them
|
// 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 );
|
int returnCode = session.applyCommandLine( argc, argv );
|
||||||
if( returnCode != 0 ) // Indicates a command line error
|
if( returnCode != 0 ) // Indicates a command line error
|
||||||
return returnCode;
|
return returnCode;
|
||||||
|
|
||||||
// writing to session.configData() or session.Config() here
|
// writing to session.configData() or session.Config() here
|
||||||
// overrides command line args
|
// overrides command line args
|
||||||
// only do this if you know you need to
|
// only do this if you know you need to
|
||||||
|
|
||||||
int numFailed = session.run();
|
int numFailed = session.run();
|
||||||
|
|
||||||
// numFailed is clamped to 255 as some unices only use the lower 8 bits.
|
// 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
|
// This clamping has already been applied, so just return it here
|
||||||
// You can also do any post run clean-up here
|
// You can also do any post run clean-up here
|
||||||
|
Loading…
Reference in New Issue
Block a user