Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-12-31 16:24:55 +0100
committerMartin Hořeňovský2022-01-01 14:20:23 +0100
commitb5547f2ef6be18f70d2e9638d8f1eb0d8d42d2ba (patch)
tree174f72ba09e22e564a571f96c21a175a68d85103 /src/catch2
parent93882f7fab9ef027bd49df781a1f542e1adb516e (diff)
downloadcatch3-b5547f2ef6be18f70d2e9638d8f1eb0d8d42d2ba.tar.gz
Passthrough stdout/err in multireporter's partial test end
This should provide the same overall stdout/err, but the new output should feel "faster" for test cases that are entered and exited multiple times (e.g. due to generators).
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/reporters/catch_reporter_listening.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp
index a08e5d59..e89090fb 100644
--- a/src/catch2/reporters/catch_reporter_listening.cpp
+++ b/src/catch2/reporters/catch_reporter_listening.cpp
@@ -136,21 +136,22 @@ namespace Catch {
void ListeningReporter::testCasePartialEnded( TestCaseStats const& testStats,
uint64_t partNumber ) {
- // TODO: Fix handling of stderr/stdout?
+ if ( m_preferences.shouldRedirectStdOut &&
+ m_haveNoncapturingReporters ) {
+ if ( !testStats.stdOut.empty() ) {
+ Catch::cout() << testStats.stdOut << std::flush;
+ }
+ if ( !testStats.stdErr.empty() ) {
+ Catch::cerr() << testStats.stdErr << std::flush;
+ }
+ }
+
for ( auto& reporterish : m_reporterLikes ) {
reporterish->testCasePartialEnded( testStats, partNumber );
}
}
void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
- if ( m_preferences.shouldRedirectStdOut && m_haveNoncapturingReporters ) {
- if ( !testCaseStats.stdOut.empty() ) {
- Catch::cout() << testCaseStats.stdOut << std::flush;
- }
- if ( !testCaseStats.stdErr.empty() ) {
- Catch::cerr() << testCaseStats.stdErr << std::flush;
- }
- }
for ( auto& reporterish : m_reporterLikes ) {
reporterish->testCaseEnded( testCaseStats );
}