catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Don't reconstruct expression on encountering fatal error
- Commit
cd6de9cd34351b12b09480d2f6fc8cdd4248862b- Author
- Martin Hořeňovský ·
- Parents
40f6a5b8a478
Changes
include/internal/catch_fatal_condition.hpp | 1 - include/internal/catch_run_context.hpp | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index 5dd10eae..1d6674fc 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -53,7 +53,6 @@ namespace Catch { static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) { if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) { - reset(); reportFatal(signalDefs[i].name); } } diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index ff63ee2a..496c32cd 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -224,10 +224,14 @@ namespace Catch { } virtual void handleFatalErrorCondition( std::string const& message ) { - ResultBuilder resultBuilder = makeUnexpectedResultBuilder(); - resultBuilder.setResultType( ResultWas::FatalErrorCondition ); - resultBuilder << message; - resultBuilder.captureExpression(); + // Don't rebuild the result -- the stringification itself can cause more fatal errors + // Instead, fake a result data. + AssertionResultData tempResult; + tempResult.resultType = ResultWas::FatalErrorCondition; + tempResult.message = message; + AssertionResult result(m_lastAssertionInfo, tempResult); + + getResultCapture().assertionEnded(result); handleUnfinishedSections();