From 3bd42417952e5065cd1ccebc1d6cdd0dbe6c4812 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 8 Apr 2013 12:05:32 +0100 Subject: [PATCH] Fixed Junit issue with REQUIRE_THROWS - As mentioned by @SebDyn in GitHub issue #5 --- 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) - + @@ -5947,9 +5947,9 @@ ConditionTests.cpp:346 ExceptionTests.cpp:43 - < message="thisDoesntThrow()" type="CHECK_THROWS_AS"> + ExceptionTests.cpp:44 - + ExceptionTests.cpp:45