mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 22:19:25 +00:00
Catch and register startup exceptions in autoregistrars
Previously they were registered where they would be thrown otherwise
This commit is contained in:
parent
da0edcbe25
commit
860de28b8d
3 changed files with 28 additions and 41 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue