mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Allow -s to be used to show successful results in test harness
This commit is contained in:
		| @@ -17,6 +17,10 @@ | |||||||
| int main (int argc, char * const argv[]) | int main (int argc, char * const argv[]) | ||||||
| { | { | ||||||
|     using namespace Catch; |     using namespace Catch; | ||||||
|  |      | ||||||
|  |     bool showAllResults = false; | ||||||
|  |     if( argc > 1 && ( std::string( argv[1] ) == "-s" || std::string( argv[1] ) == "--success" ) ) | ||||||
|  |         showAllResults = true; | ||||||
|          |          | ||||||
|     ReporterConfig reporterConfig( ReporterConfig::Include::SuccessfulResults ); |     ReporterConfig reporterConfig( ReporterConfig::Include::SuccessfulResults ); | ||||||
|     BasicReporter reporter (reporterConfig ); |     BasicReporter reporter (reporterConfig ); | ||||||
| @@ -39,11 +43,19 @@ int main (int argc, char * const argv[]) | |||||||
|         std::cerr << "Some tests that should have succeeded failed:\n\n" << succeedingResults; |         std::cerr << "Some tests that should have succeeded failed:\n\n" << succeedingResults; | ||||||
|         result = 1; |         result = 1; | ||||||
|     } |     } | ||||||
|  |     else if( showAllResults ) | ||||||
|  |     { | ||||||
|  |         std::cout << succeedingResults << "\n\n"; | ||||||
|  |     } | ||||||
|     if( failingResults.find( "succeeded" ) != std::string::npos ) |     if( failingResults.find( "succeeded" ) != std::string::npos ) | ||||||
|     { |     { | ||||||
|         std::cerr << "Some tests that should have failed succeeded:\n\n" << failingResults; |         std::cerr << "Some tests that should have failed succeeded:\n\n" << failingResults; | ||||||
|         result = 1; |         result = 1; | ||||||
|     } |     } | ||||||
|  |     else if( showAllResults ) | ||||||
|  |     { | ||||||
|  |         std::cout << failingResults << "\n\n"; | ||||||
|  |     } | ||||||
|      |      | ||||||
|     if( result == 0 ) |     if( result == 0 ) | ||||||
|     { |     { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash