mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
Store singular TestRunNode in CumulativeReporterBase
There can never be more than one, so there is no reason to provide genericity over multiple nodes.
This commit is contained in:
parent
e5938007f7
commit
290c1b60e6
@ -100,8 +100,9 @@ namespace Catch {
|
|||||||
|
|
||||||
|
|
||||||
void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) {
|
void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) {
|
||||||
m_testRuns.emplace_back( testRunStats );
|
assert(!m_testRun && "CumulativeReporterBase assumes there can only be one test run");
|
||||||
m_testRuns.back().children.swap( m_testCases );
|
m_testRun = Detail::make_unique<TestRunNode>( testRunStats );
|
||||||
|
m_testRun->children.swap( m_testCases );
|
||||||
testRunEndedCumulative();
|
testRunEndedCumulative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,10 +73,11 @@ namespace Catch {
|
|||||||
|
|
||||||
std::ostream& stream;
|
std::ostream& stream;
|
||||||
// Note: We rely on pointer identity being stable, which is why
|
// Note: We rely on pointer identity being stable, which is why
|
||||||
// which is why we store around pointers rather than values.
|
// we store pointers to the nodes rather than the values.
|
||||||
std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases;
|
std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases;
|
||||||
|
// We need lazy construction here. We should probably refactor it
|
||||||
std::vector<TestRunNode> m_testRuns;
|
// later, after the events are redone.
|
||||||
|
Detail::unique_ptr<TestRunNode> m_testRun;
|
||||||
|
|
||||||
Detail::unique_ptr<SectionNode> m_rootSection;
|
Detail::unique_ptr<SectionNode> m_rootSection;
|
||||||
SectionNode* m_deepestSection = nullptr;
|
SectionNode* m_deepestSection = nullptr;
|
||||||
|
@ -99,10 +99,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void JunitReporter::testRunEndedCumulative() {
|
void JunitReporter::testRunEndedCumulative() {
|
||||||
const auto suiteTime = suiteTimer.getElapsedSeconds();
|
const auto suiteTime = suiteTimer.getElapsedSeconds();
|
||||||
// HACK: There can only be one testRunNode? This needs to be
|
writeRun( *m_testRun, suiteTime );
|
||||||
// refactored after the group nodes are excised.
|
|
||||||
assert(m_testRuns.size() == 1);
|
|
||||||
writeRun( m_testRuns.back(), suiteTime );
|
|
||||||
xml.endElement();
|
xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,10 +35,7 @@ namespace Catch {
|
|||||||
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
||||||
|
|
||||||
void testRunEndedCumulative() override {
|
void testRunEndedCumulative() override {
|
||||||
// HACK: There can only be one testRunNode? This needs to be
|
writeRun( *m_testRun );
|
||||||
// refactored after the group nodes are excised.
|
|
||||||
assert( m_testRuns.size() == 1 );
|
|
||||||
writeRun( m_testRuns.back() );
|
|
||||||
xml.endElement();
|
xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user