Skip to content

Commit b5547f2

Browse files
committed
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).
1 parent 93882f7 commit b5547f2

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/catch2/reporters/catch_reporter_listening.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,22 @@ namespace Catch {
136136

137137
void ListeningReporter::testCasePartialEnded( TestCaseStats const& testStats,
138138
uint64_t partNumber ) {
139-
// TODO: Fix handling of stderr/stdout?
139+
if ( m_preferences.shouldRedirectStdOut &&
140+
m_haveNoncapturingReporters ) {
141+
if ( !testStats.stdOut.empty() ) {
142+
Catch::cout() << testStats.stdOut << std::flush;
143+
}
144+
if ( !testStats.stdErr.empty() ) {
145+
Catch::cerr() << testStats.stdErr << std::flush;
146+
}
147+
}
148+
140149
for ( auto& reporterish : m_reporterLikes ) {
141150
reporterish->testCasePartialEnded( testStats, partNumber );
142151
}
143152
}
144153

145154
void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
146-
if ( m_preferences.shouldRedirectStdOut && m_haveNoncapturingReporters ) {
147-
if ( !testCaseStats.stdOut.empty() ) {
148-
Catch::cout() << testCaseStats.stdOut << std::flush;
149-
}
150-
if ( !testCaseStats.stdErr.empty() ) {
151-
Catch::cerr() << testCaseStats.stdErr << std::flush;
152-
}
153-
}
154155
for ( auto& reporterish : m_reporterLikes ) {
155156
reporterish->testCaseEnded( testCaseStats );
156157
}

0 commit comments

Comments
 (0)