Skip to content

Commit

Permalink
Rollback fine-grained redirect settings
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Aug 12, 2024
1 parent 17a0f8f commit 3bb8639
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions src/catch2/internal/catch_run_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,7 @@ namespace Catch {
m_lastAssertionPassed = true;
}

{
auto _ = scopedDeactivate( *m_outputRedirect );
m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );
}
m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );

if ( result.getResultType() != ResultWas::Warning ) {
m_messageScopes.clear();
Expand All @@ -312,14 +309,12 @@ namespace Catch {
}

void RunContext::notifyAssertionStarted( AssertionInfo const& info ) {
auto _ = scopedDeactivate( *m_outputRedirect );
m_reporter->assertionStarting( info );
}

bool RunContext::sectionStarted( StringRef sectionName,
SourceLineInfo const& sectionLineInfo,
Counts& assertions ) {
auto _ = scopedDeactivate( *m_outputRedirect );
ITracker& sectionTracker =
SectionTracker::acquire( m_trackerContext,
TestCaseTracking::NameAndLocationRef(
Expand Down Expand Up @@ -384,7 +379,6 @@ namespace Catch {
}

void RunContext::sectionEnded(SectionEndInfo&& endInfo) {
auto _ = scopedDeactivate( *m_outputRedirect );
Counts assertions = m_totals.assertions - endInfo.prevAssertions;
bool missingAssertions = testForMissingAssertions(assertions);

Expand All @@ -399,7 +393,6 @@ namespace Catch {
}

void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) {
auto _ = scopedDeactivate( *m_outputRedirect );
if ( m_unfinishedSections.empty() ) {
m_activeSections.back()->fail();
} else {
Expand Down Expand Up @@ -577,7 +570,6 @@ namespace Catch {
itEnd = m_unfinishedSections.rend();
it != itEnd;
++it ) {
scopedActivate( *m_outputRedirect );
sectionEnded( CATCH_MOVE( *it ) );
}
m_unfinishedSections.clear();
Expand Down
4 changes: 2 additions & 2 deletions tests/SelfTest/UsageTests/Misc.tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,14 @@ TEST_CASE( "# A test name that starts with a #" ) {
SUCCEED( "yay" );
}

TEST_CASE( "REDIRECT: multiple outputs 1", "[redirect-test]" ) {
TEST_CASE( "REDIRECT: multiple outputs 1", "[approvals][redirect-test]" ) {
std::cout << "start 1\n";
SECTION( "A" ) { std::cout << "A\n"; }
SECTION( "B" ) { std::cout << "B\n"; }
std::cout << "end 1\n";
}

TEST_CASE( "REDIRECT: multiple outputs 2", "[redirect-test]" ) {
TEST_CASE( "REDIRECT: multiple outputs 2", "[approvals][redirect-test]" ) {
std::cout << "start 2\n";
SECTION( "A" ) { std::cout << "A\n"; }
SECTION( "B" ) { std::cout << "B\n"; }
Expand Down

0 comments on commit 3bb8639

Please sign in to comment.