Skip to content

Commit

Permalink
More tests for multireporter: infering stdout passthrough correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Dec 29, 2021
1 parent 3d5c13f commit 4362c0f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,33 @@ set_tests_properties("ErrorHandling::InvalidTestSpecExitsEarly"
FAIL_REGULAR_EXPRESSION "No tests ran"
)

if (MSVC)
set(_NullFile "NUL")
else()
set(_NullFile "/dev/null")
endif()

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 ".+"
)
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>)
Expand Down

0 comments on commit 4362c0f

Please sign in to comment.