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

Extract what() message from std::exceptions in _NO_THROW()

Commit
381fffe07d3ade6ef0c7bfc57acf67a3d6f5352b
Author
Phil Nash ·
Parents
3e512bd3164b

Files · Download .tar.gz

Changes

 internal/catch_capture.hpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/internal/catch_capture.hpp b/internal/catch_capture.hpp
index 1d36a21b..6763353a 100644
--- a/internal/catch_capture.hpp
+++ b/internal/catch_capture.hpp
@@ -729,6 +729,10 @@ inline bool isTrue
         expr; \
         INTERNAL_CATCH_ACCEPT_EXPR( Catch::ResultBuilder( __FILE__, __LINE__, macroName, #expr ).setResultType( Catch::ResultWas::Ok ), stopOnFailure ); \
     } \
+    catch( std::exception& ex ) \
+    { \
+        INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ResultBuilder( __FILE__, __LINE__, macroName, #expr ) << ex.what() ).setResultType( Catch::ResultWas::ThrewException ), stopOnFailure ); \
+    } \
     catch( ... ) \
     { \
         INTERNAL_CATCH_ACCEPT_EXPR( Catch::ResultBuilder( __FILE__, __LINE__, macroName, #expr ).setResultType( Catch::ResultWas::ThrewException ), stopOnFailure ); \