mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Add test for stdout pass-through behaviour in MultiReporter
This commit is contained in:
		| @@ -418,6 +418,39 @@ set_tests_properties("ErrorHandling::InvalidTestSpecExitsEarly" | ||||
|     FAIL_REGULAR_EXPRESSION "No tests ran" | ||||
| ) | ||||
|  | ||||
| if (MSVC) | ||||
|   set(_NullFile "NUL") | ||||
| else() | ||||
|   set(_NullFile "/dev/null") | ||||
| endif() | ||||
|  | ||||
| # This test checks that there is nothing written out from the process, | ||||
| # but if CMake is running the tests under Valgrind or similar tool, then | ||||
| # that will write its own output to stdout and the test would fail. | ||||
| if (NOT MEMORYCHECK_COMMAND) | ||||
|   add_test(NAME "MultiReporter::CapturingReportersDontPropagateStdOut" | ||||
|     COMMAND | ||||
|       $<TARGET_FILE:SelfTest> "Sends stuff to stdout and stderr" | ||||
|         --reporter xml::${_NullFile} | ||||
|         --reporter junit::${_NullFile} | ||||
|   ) | ||||
|   set_tests_properties("MultiReporter::CapturingReportersDontPropagateStdOut" | ||||
|     PROPERTIES | ||||
|       FAIL_REGULAR_EXPRESSION ".+" | ||||
|   ) | ||||
| endif() | ||||
|  | ||||
| add_test(NAME "MultiReporter::NonCapturingReportersPropagateStdout" | ||||
|   COMMAND | ||||
|     $<TARGET_FILE:SelfTest> "Sends stuff to stdout and stderr" | ||||
|       --reporter xml::${_NullFile} | ||||
|       --reporter console::${_NullFile} | ||||
| ) | ||||
| set_tests_properties("MultiReporter::NonCapturingReportersPropagateStdout" | ||||
|   PROPERTIES | ||||
|     PASS_REGULAR_EXPRESSION "A string sent to stderr via clog" | ||||
| ) | ||||
|  | ||||
|  | ||||
| if (CATCH_USE_VALGRIND) | ||||
|     add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský