From 3bb863990b26ac3f7e58d1ec6ecea280bdf5d685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 12 Aug 2024 15:23:46 +0200 Subject: [PATCH] Rollback fine-grained redirect settings --- src/catch2/internal/catch_run_context.cpp | 10 +--------- tests/SelfTest/UsageTests/Misc.tests.cpp | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 7310ce2544..81c84d89f7 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -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(); @@ -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( @@ -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); @@ -399,7 +393,6 @@ namespace Catch { } void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) { - auto _ = scopedDeactivate( *m_outputRedirect ); if ( m_unfinishedSections.empty() ) { m_activeSections.back()->fail(); } else { @@ -577,7 +570,6 @@ namespace Catch { itEnd = m_unfinishedSections.rend(); it != itEnd; ++it ) { - scopedActivate( *m_outputRedirect ); sectionEnded( CATCH_MOVE( *it ) ); } m_unfinishedSections.clear(); diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index c13e974978..018d3dfce5 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -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"; }