mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Tweaked how failedButOk assertions are recorded
- fixes issue where sections in !shouldfail or !mayfail test cases that have failing assertions where marked as failed instead of failedButOk
This commit is contained in:
		| @@ -112,6 +112,9 @@ namespace Catch { | |||||||
|         if (result.getResultType() == ResultWas::Ok) { |         if (result.getResultType() == ResultWas::Ok) { | ||||||
|             m_totals.assertions.passed++; |             m_totals.assertions.passed++; | ||||||
|         } else if (!result.isOk()) { |         } else if (!result.isOk()) { | ||||||
|  |             if( m_activeTestCase->getTestCaseInfo().okToFail() ) | ||||||
|  |                 m_totals.assertions.failedButOk++; | ||||||
|  |             else | ||||||
|                 m_totals.assertions.failed++; |                 m_totals.assertions.failed++; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -297,13 +300,6 @@ namespace Catch { | |||||||
|  |  | ||||||
|         Counts assertions = m_totals.assertions - prevAssertions; |         Counts assertions = m_totals.assertions - prevAssertions; | ||||||
|         bool missingAssertions = testForMissingAssertions(assertions); |         bool missingAssertions = testForMissingAssertions(assertions); | ||||||
|  |  | ||||||
|         if (testCaseInfo.okToFail()) { |  | ||||||
|             std::swap(assertions.failedButOk, assertions.failed); |  | ||||||
|             m_totals.assertions.failed -= assertions.failedButOk; |  | ||||||
|             m_totals.assertions.failedButOk += assertions.failedButOk; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); |         SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); | ||||||
|         m_reporter->sectionEnded(testCaseSectionStats); |         m_reporter->sectionEnded(testCaseSectionStats); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ | |||||||
|         <Exception filename="projects/<exe-name>/ExceptionTests.cpp" > |         <Exception filename="projects/<exe-name>/ExceptionTests.cpp" > | ||||||
|           expected exception |           expected exception | ||||||
|         </Exception> |         </Exception> | ||||||
|         <OverallResults successes="0" failures="1" expectedFailures="0"/> |         <OverallResults successes="0" failures="0" expectedFailures="1"/> | ||||||
|       </Section> |       </Section> | ||||||
|       <Section name="inside REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" > |       <Section name="inside REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" > | ||||||
|         <Info> |         <Info> | ||||||
| @@ -29,7 +29,7 @@ | |||||||
|             expected exception |             expected exception | ||||||
|           </Exception> |           </Exception> | ||||||
|         </Expression> |         </Expression> | ||||||
|         <OverallResults successes="0" failures="1" expectedFailures="0"/> |         <OverallResults successes="0" failures="0" expectedFailures="1"/> | ||||||
|       </Section> |       </Section> | ||||||
|       <Section name="inside REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" > |       <Section name="inside REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" > | ||||||
|         <Info> |         <Info> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash