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

Fix issue with fatal errors and non-failing assertions

Fixes #990
Commit
9688891868e051bb1d8a005b293229d9428bed34
Author
Phil Nash ·
Committer
Martin Hořeňovský
Parents
4f21bb72ff16

Files · Download .tar.gz

Changes

 include/internal/catch_run_context.hpp | 1 +
 projects/SelfTest/TrickyTests.cpp      | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp
index 8cd637c6..30a34586 100644
--- a/include/internal/catch_run_context.hpp
+++ b/include/internal/catch_run_context.hpp
@@ -295,6 +295,7 @@ namespace Catch {
 
             Totals deltaTotals;
             deltaTotals.testCases.failed = 1;
+            deltaTotals.assertions.failed = 1;
             m_reporter->testCaseEnded( TestCaseStats(   testInfo,
                                                         deltaTotals,
                                                         std::string(),
diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp
index 26625b03..60f58131 100644
--- a/projects/SelfTest/TrickyTests.cpp
+++ b/projects/SelfTest/TrickyTests.cpp
@@ -407,3 +407,9 @@ TEST_CASE( "has printf", "" ) {
     // This can cause problems as, currently, stdout itself is not redirect - only the cout (and cerr) buffer
     printf( "spanner" );
 }
+
+TEST_CASE( "null deref", "[.][failing][!nonportable]" ) {
+    CHECK( false );
+    int *x = NULL;
+    *x = 1;
+}