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:
		| @@ -166,7 +166,10 @@ namespace Catch { | ||||
|                 m_totals.assertions.passed++; | ||||
|             } | ||||
|             else if( !result.isOk() ) { | ||||
|                 m_totals.assertions.failed++; | ||||
|                 if( m_activeTestCase->getTestCaseInfo().okToFail() ) | ||||
|                     m_totals.assertions.failedButOk++; | ||||
|                 else | ||||
|                     m_totals.assertions.failed++; | ||||
|             } | ||||
|  | ||||
|             // We have no use for the return value (whether messages should be cleared), because messages were made scoped | ||||
| @@ -355,12 +358,6 @@ namespace Catch { | ||||
|             Counts assertions = m_totals.assertions - prevAssertions; | ||||
|             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 ); | ||||
|             m_reporter->sectionEnded( testCaseSectionStats ); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash