diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index ec3c28ad..00beb384 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -128,6 +128,11 @@ namespace Catch { Totals deltaTotals = m_totals.delta( prevTotals ); + if( testCase.expectedToFail() && deltaTotals.testCases.passed > 0 ) { + deltaTotals.assertions.failed++; + deltaTotals.testCases.passed--; + deltaTotals.testCases.failed++; + } m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded( TestCaseStats( testCase, deltaTotals, diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index e7367039..5564d885 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -349,7 +349,7 @@ namespace Catch { if( totals.testCases.total() == 0 ) { stream << Colour( Colour::Warning ) << "No tests ran\n"; } - else if( totals.assertions.total() > 0 && totals.assertions.allPassed() ) { + else if( totals.assertions.total() > 0 && totals.testCases.allPassed() ) { stream << Colour( Colour::ResultSuccess ) << "All tests passed"; stream << " (" << pluralise( totals.assertions.passed, "assertion" ) << " in " diff --git a/projects/SelfTest/ConditionTests.cpp b/projects/SelfTest/ConditionTests.cpp index d1b7ed24..b1d29106 100644 --- a/projects/SelfTest/ConditionTests.cpp +++ b/projects/SelfTest/ConditionTests.cpp @@ -101,7 +101,7 @@ TEST_CASE( "Inequality checks that should succeed", "" ) REQUIRE( data.str_hello.size() != 6 ); } -TEST_CASE( "Inequality checks that should fail", "[.][failing]" ) +TEST_CASE( "Inequality checks that should fail", "[.][failing][!shouldfail]" ) { TestData data; diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 5a773251..0310c1fd 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -480,3 +480,8 @@ TEST_CASE( "long long" ) { // CHECK( x == 0 ); // } //} + +TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" ) +{ + SUCCEED( "oops!" ); +}