mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-26 22:35:40 +02:00
Catch and register startup exceptions in autoregistrars
Previously they were registered where they would be thrown otherwise
This commit is contained in:
@@ -154,14 +154,18 @@ namespace Catch {
|
||||
char const* classOrQualifiedMethodName,
|
||||
NameAndDesc const& nameAndDesc,
|
||||
SourceLineInfo const& lineInfo ) {
|
||||
|
||||
getMutableRegistryHub().registerTest
|
||||
( makeTestCase
|
||||
( testCase,
|
||||
extractClassName( classOrQualifiedMethodName ),
|
||||
nameAndDesc.name,
|
||||
nameAndDesc.description,
|
||||
lineInfo ) );
|
||||
try {
|
||||
getMutableRegistryHub().registerTest
|
||||
(makeTestCase
|
||||
(testCase,
|
||||
extractClassName(classOrQualifiedMethodName),
|
||||
nameAndDesc.name,
|
||||
nameAndDesc.description,
|
||||
lineInfo));
|
||||
} catch (...) {
|
||||
// Do not throw when constructing global objects, instead register the exception to be processed later
|
||||
getMutableRegistryHub().registerStartupException( std::current_exception() );
|
||||
}
|
||||
}
|
||||
void registerTestCaseFunction
|
||||
( TestFunction function,
|
||||
|
Reference in New Issue
Block a user