mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Completed NoAssertions warning implementation
This commit is contained in:
		| @@ -289,3 +289,7 @@ TEST_CASE( "example/factorial", "The Factorial function should return the factor | ||||
|   REQUIRE( Factorial(3) == 6 ); | ||||
|   REQUIRE( Factorial(10) == 3628800 ); | ||||
| } | ||||
|  | ||||
| TEST_CASE( "empty", "An empty test with no assertions" ) | ||||
| { | ||||
| } | ||||
|   | ||||
| @@ -74,7 +74,10 @@ namespace Catch { | ||||
|         virtual void StartSection( const std::string& sectionName, const std::string& ) { | ||||
|             openLabel( recordSections, sectionName ); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         virtual void NoAssertionsInSection( const std::string& ) {} | ||||
|         virtual void NoAssertionsInTestCase( const std::string& ) {} | ||||
|  | ||||
|         virtual void EndSection( const std::string& sectionName, const Counts& ) { | ||||
|             closeLabel( recordSections, sectionName ); | ||||
|         } | ||||
| @@ -162,6 +165,9 @@ namespace Catch { | ||||
|                              << "' to succeed but there was/ were "  | ||||
|                              << totals.assertions.failed << " failure(s)" ); | ||||
|                     } | ||||
|                     else { | ||||
|                         SUCCEED( "Tests passed, as expected" ); | ||||
|                     } | ||||
|                     break; | ||||
|                 case Expected::ToFail: | ||||
|                     if( totals.assertions.passed > 0 ) { | ||||
| @@ -171,6 +177,9 @@ namespace Catch { | ||||
|                              << "' to fail but there was/ were "  | ||||
|                              << totals.assertions.passed << " success(es)" ); | ||||
|                     } | ||||
|                     else { | ||||
|                         SUCCEED( "Tests failed, as expected" ); | ||||
|                     } | ||||
|                     break; | ||||
|             }         | ||||
|         }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash