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

Fixed Junit issue with REQUIRE_THROWS

- As mentioned by @SebDyn in GitHub issue #5
Commit
3bd42417952e5065cd1ccebc1d6cdd0dbe6c4812
Author
Phil Nash ·
Parents
8764177c0e85

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_console.hpp    | 10 +---------
 include/reporters/catch_reporter_junit.hpp      |  6 +++++-
 projects/SelfTest/Baselines/approvedResults.txt |  6 +++---
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index cb50436d..9cd25e89 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -155,18 +155,10 @@ namespace Catch {
                         if( _stats.infoMessages.size() > 1 )
                             messageLabel = "explicitly with messages";
                         break;
-                    case ResultWas::Exception:
-                        passOrFail = "FAILED";
-                        colour = Colour::Error;
-                        if( _stats.infoMessages.size() == 1 )
-                            messageLabel = "with message";
-                        if( _stats.infoMessages.size() > 1 )
-                            messageLabel = "with messages";
-                        break;
-                        
                     // These cases are here to prevent compiler warnings
                     case ResultWas::Unknown:
                     case ResultWas::FailureBit:
+                    case ResultWas::Exception:
                         passOrFail = "** internal error **";
                         colour = Colour::Error;
                         break;
diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp
index af43b3b7..7e2f4b2b 100644
--- a/include/reporters/catch_reporter_junit.hpp
+++ b/include/reporters/catch_reporter_junit.hpp
@@ -143,10 +143,14 @@ namespace Catch {
                     case ResultWas::Ok:
                         stats.m_element = "success";
                         break;
+                    case ResultWas::DidntThrowException:
+                        stats.m_element = "failure";
+                        m_currentStats->m_failuresCount++;
+                        break;
                     case ResultWas::Unknown:
                     case ResultWas::FailureBit:
                     case ResultWas::Exception:
-                    case ResultWas::DidntThrowException:
+                        stats.m_element = "* internal error *";
                         break;
                 }
                 testCaseStats.m_testStats.push_back( stats );                
diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt
index aebdee5b..9b668439 100644
--- a/projects/SelfTest/Baselines/approvedResults.txt
+++ b/projects/SelfTest/Baselines/approvedResults.txt
@@ -5769,7 +5769,7 @@ with expansion:
 13 test cases - 3 failed (40 assertions - 4 failed)
 
 <testsuites>
-  <testsuite name="~dummy" errors="9" failures="77" tests="699" hostname="tbd" time="tbd" timestamp="tbd">
+  <testsuite name="~dummy" errors="9" failures="78" tests="699" hostname="tbd" time="tbd" timestamp="tbd">
     <testcase classname="global" name="./succeeding/Approx/simple" time="tbd"/>
     <testcase classname="global" name="./succeeding/Approx/epsilon" time="tbd"/>
     <testcase classname="global" name="./succeeding/Approx/float" time="tbd"/>
@@ -5947,9 +5947,9 @@ ConditionTests.cpp:346
       <error message="thisThrows()" type="CHECK_THROWS_AS">
 ExceptionTests.cpp:43
       </error>
-      < message="thisDoesntThrow()" type="CHECK_THROWS_AS">
+      <failure message="thisDoesntThrow()" type="CHECK_THROWS_AS">
 ExceptionTests.cpp:44
-      </>
+      </failure>
       <error message="thisThrows()" type="CHECK_NOTHROW">
 ExceptionTests.cpp:45
       </error>