mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Move captured output into TestCaseStats when sending testCaseEnded
This commit is contained in:
parent
fed1436246
commit
00f259aeb2
@ -79,13 +79,13 @@ namespace Catch {
|
|||||||
|
|
||||||
TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
|
TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
|
||||||
Totals const& _totals,
|
Totals const& _totals,
|
||||||
std::string const& _stdOut,
|
std::string&& _stdOut,
|
||||||
std::string const& _stdErr,
|
std::string&& _stdErr,
|
||||||
bool _aborting )
|
bool _aborting )
|
||||||
: testInfo( &_testInfo ),
|
: testInfo( &_testInfo ),
|
||||||
totals( _totals ),
|
totals( _totals ),
|
||||||
stdOut( _stdOut ),
|
stdOut( CATCH_MOVE(_stdOut) ),
|
||||||
stdErr( _stdErr ),
|
stdErr( CATCH_MOVE(_stdErr) ),
|
||||||
aborting( _aborting )
|
aborting( _aborting )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ namespace Catch {
|
|||||||
struct TestCaseStats {
|
struct TestCaseStats {
|
||||||
TestCaseStats( TestCaseInfo const& _testInfo,
|
TestCaseStats( TestCaseInfo const& _testInfo,
|
||||||
Totals const& _totals,
|
Totals const& _totals,
|
||||||
std::string const& _stdOut,
|
std::string&& _stdOut,
|
||||||
std::string const& _stdErr,
|
std::string&& _stdErr,
|
||||||
bool _aborting );
|
bool _aborting );
|
||||||
|
|
||||||
TestCaseInfo const * testInfo;
|
TestCaseInfo const * testInfo;
|
||||||
|
@ -176,13 +176,8 @@ namespace Catch {
|
|||||||
Totals RunContext::runTest(TestCaseHandle const& testCase) {
|
Totals RunContext::runTest(TestCaseHandle const& testCase) {
|
||||||
const Totals prevTotals = m_totals;
|
const Totals prevTotals = m_totals;
|
||||||
|
|
||||||
std::string redirectedCout;
|
|
||||||
std::string redirectedCerr;
|
|
||||||
|
|
||||||
auto const& testInfo = testCase.getTestCaseInfo();
|
auto const& testInfo = testCase.getTestCaseInfo();
|
||||||
|
|
||||||
m_reporter->testCaseStarting(testInfo);
|
m_reporter->testCaseStarting(testInfo);
|
||||||
|
|
||||||
m_activeTestCase = &testCase;
|
m_activeTestCase = &testCase;
|
||||||
|
|
||||||
|
|
||||||
@ -224,6 +219,8 @@ namespace Catch {
|
|||||||
seedRng( *m_config );
|
seedRng( *m_config );
|
||||||
|
|
||||||
uint64_t testRuns = 0;
|
uint64_t testRuns = 0;
|
||||||
|
std::string redirectedCout;
|
||||||
|
std::string redirectedCerr;
|
||||||
do {
|
do {
|
||||||
m_trackerContext.startCycle();
|
m_trackerContext.startCycle();
|
||||||
m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo));
|
m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo));
|
||||||
@ -237,7 +234,7 @@ namespace Catch {
|
|||||||
redirectedCerr += oneRunCerr;
|
redirectedCerr += oneRunCerr;
|
||||||
|
|
||||||
const auto singleRunTotals = m_totals.delta(beforeRunTotals);
|
const auto singleRunTotals = m_totals.delta(beforeRunTotals);
|
||||||
auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, oneRunCout, oneRunCerr, aborting());
|
auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, CATCH_MOVE(oneRunCout), CATCH_MOVE(oneRunCerr), aborting());
|
||||||
|
|
||||||
m_reporter->testCasePartialEnded(statsForOneRun, testRuns);
|
m_reporter->testCasePartialEnded(statsForOneRun, testRuns);
|
||||||
++testRuns;
|
++testRuns;
|
||||||
@ -252,8 +249,8 @@ namespace Catch {
|
|||||||
m_totals.testCases += deltaTotals.testCases;
|
m_totals.testCases += deltaTotals.testCases;
|
||||||
m_reporter->testCaseEnded(TestCaseStats(testInfo,
|
m_reporter->testCaseEnded(TestCaseStats(testInfo,
|
||||||
deltaTotals,
|
deltaTotals,
|
||||||
redirectedCout,
|
CATCH_MOVE(redirectedCout),
|
||||||
redirectedCerr,
|
CATCH_MOVE(redirectedCerr),
|
||||||
aborting()));
|
aborting()));
|
||||||
|
|
||||||
m_activeTestCase = nullptr;
|
m_activeTestCase = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user