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
End the death-test child in one place
- Commit
e98edd22678bf266ac4dc9024f88ecd26fdac6d6- Author
- Leitwolf11 ·
- Parents
5ecb0656b3ac
Changes
extras/catch_amalgamated.cpp | 7 ++++--- src/Progmasoft/Death.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp index 10052c1c..7ac09a24 100644 --- a/extras/catch_amalgamated.cpp +++ b/extras/catch_amalgamated.cpp @@ -9039,13 +9039,14 @@ namespace Progmasoft::Catch3 { RestoreDefaultEndings(); std::fflush( stdout ); WriteError( kReached ); + // Reaching the end means the statement did not end the process. + bool threw = false; CATCH_TRY { statement(); } CATCH_CATCH_ALL { - WriteError( kThrew ); - std::_Exit( kChildSurvived ); + threw = true; } - WriteError( kReturned ); + WriteError( threw ? kThrew : kReturned ); std::_Exit( kChildSurvived ); } diff --git a/src/Progmasoft/Death.cpp b/src/Progmasoft/Death.cpp index 15ed00d0..d6aa7a8b 100644 --- a/src/Progmasoft/Death.cpp +++ b/src/Progmasoft/Death.cpp @@ -120,13 +120,14 @@ namespace Progmasoft::Catch3 { RestoreDefaultEndings(); std::fflush( stdout ); WriteError( kReached ); + // Reaching the end means the statement did not end the process. + bool threw = false; CATCH_TRY { statement(); } CATCH_CATCH_ALL { - WriteError( kThrew ); - std::_Exit( kChildSurvived ); + threw = true; } - WriteError( kReturned ); + WriteError( threw ? kThrew : kReturned ); std::_Exit( kChildSurvived ); }