Progmasoft Git

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

Build the death-test child without exceptions too

The DisabledExceptions extra tests compile the library with
-fno-exceptions, and the bare try of RunInChild stopped them. It uses
CATCH_TRY and CATCH_CATCH_ALL now, as the rest of Catch does: with
exceptions off the statement cannot throw, and the child reports that it
returned. Death.cpp and the amalgamation compile with and without
-fno-exceptions.
Commit
5ecb0656b3ac4a880c081e6f57204d5a99044684
Author
Leitwolf11 ·
Parents
3942a6df352e

Files · Download .tar.gz

Changes

 extras/catch_amalgamated.cpp | 4 ++--
 src/Progmasoft/Death.cpp     | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index dfd6f1a6..10052c1c 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -9039,9 +9039,9 @@ namespace Progmasoft::Catch3 {
             RestoreDefaultEndings();
             std::fflush( stdout );
             WriteError( kReached );
-            try {
+            CATCH_TRY {
                 statement();
-            } catch ( ... ) {
+            } CATCH_CATCH_ALL {
                 WriteError( kThrew );
                 std::_Exit( kChildSurvived );
             }
diff --git a/src/Progmasoft/Death.cpp b/src/Progmasoft/Death.cpp
index e032b4cb..15ed00d0 100644
--- a/src/Progmasoft/Death.cpp
+++ b/src/Progmasoft/Death.cpp
@@ -3,6 +3,7 @@
 #include <Progmasoft/Catch3/Death.hpp>
 
 #include <Progmasoft/Catch3/Interfaces/IResultCapture.hpp>
+#include <Progmasoft/Catch3/Internal/CompilerCapabilities.hpp>
 #include <Progmasoft/Runner/Hash.hpp>
 #include <Progmasoft/Runner/Process.hpp>
 
@@ -119,9 +120,9 @@ namespace Progmasoft::Catch3 {
             RestoreDefaultEndings();
             std::fflush( stdout );
             WriteError( kReached );
-            try {
+            CATCH_TRY {
                 statement();
-            } catch ( ... ) {
+            } CATCH_CATCH_ALL {
                 WriteError( kThrew );
                 std::_Exit( kChildSurvived );
             }