Cleanup visibility in CumulativeReporterBase

This commit is contained in:
Martin Hořeňovský 2021-11-14 11:22:29 +01:00
parent 0c9fe16537
commit b892ab133c
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 16 additions and 10 deletions

View File

@ -146,18 +146,18 @@ namespace Catch {
}
void CumulativeReporterBase::listReporters(std::vector<ReporterDescription> const& descriptions) {
defaultListReporters(stream, descriptions, m_config->verbosity());
defaultListReporters(m_stream, descriptions, m_config->verbosity());
}
void CumulativeReporterBase::listTests(std::vector<TestCaseHandle> const& tests) {
defaultListTests(stream,
defaultListTests(m_stream,
tests,
m_config->hasTestFilters(),
m_config->verbosity());
}
void CumulativeReporterBase::listTags(std::vector<TagInfo> const& tags) {
defaultListTags( stream, tags, m_config->hasTestFilters() );
defaultListTags( m_stream, tags, m_config->hasTestFilters() );
}
bool CumulativeReporterBase::SectionNode::hasAnyAssertions() const {

View File

@ -59,7 +59,8 @@ namespace Catch {
* performance. **Accessing the assertion expansions if it wasn't stored is
* UB.**
*/
struct CumulativeReporterBase : IStreamingReporter {
class CumulativeReporterBase : public IStreamingReporter {
public:
template<typename T, typename ChildNodeT>
struct Node {
explicit Node( T const& _value ) : value( _value ) {}
@ -90,7 +91,7 @@ namespace Catch {
CumulativeReporterBase( ReporterConfig const& _config ):
IStreamingReporter( _config.fullConfig() ),
stream( _config.stream() ) {}
m_stream( _config.stream() ) {}
~CumulativeReporterBase() override;
void benchmarkPreparing( StringRef ) override {}
@ -131,17 +132,22 @@ namespace Catch {
bool m_shouldStoreFailedAssertions = true;
//! Stream to write the output to
std::ostream& stream;
std::ostream& m_stream;
// We need lazy construction here. We should probably refactor it
// later, after the events are redone.
//! The root node of the test run tree.
Detail::unique_ptr<TestRunNode> m_testRun;
private:
// Note: We rely on pointer identity being stable, which is why
// we store pointers to the nodes rather than the values.
std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases;
// We need lazy construction here. We should probably refactor it
// later, after the events are redone.
Detail::unique_ptr<TestRunNode> m_testRun;
// Root section of the _current_ test case
Detail::unique_ptr<SectionNode> m_rootSection;
// Deepest section of the _current_ test case
SectionNode* m_deepestSection = nullptr;
// Stack of _active_ sections in the _current_ test case
std::vector<SectionNode*> m_sectionStack;
};