mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Store IStream instance owning ptrs in reporter instances
This ended up being a surprisingly large refactoring, motivated by removing a `const_cast` from `Config`'s handling of reporter streams, forced by previous commit.
This commit is contained in:
		@@ -20,12 +20,13 @@
 | 
			
		||||
#include <catch2/reporters/catch_reporter_registrars.hpp>
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
class CumulativeBenchmarkReporter final : public Catch::CumulativeReporterBase {
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    CumulativeBenchmarkReporter(Catch::ReporterConfig const& _config) :
 | 
			
		||||
        CumulativeReporterBase(_config) {
 | 
			
		||||
    CumulativeBenchmarkReporter(Catch::ReporterConfig&& _config) :
 | 
			
		||||
        CumulativeReporterBase(std::move(_config)) {
 | 
			
		||||
        m_preferences.shouldReportAllAssertions = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,11 +19,12 @@
 | 
			
		||||
#include <catch2/reporters/catch_reporter_registrars.hpp>
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
class TestReporter : public Catch::StreamingReporterBase {
 | 
			
		||||
public:
 | 
			
		||||
    TestReporter(Catch::ReporterConfig const& _config):
 | 
			
		||||
        StreamingReporterBase(_config) {
 | 
			
		||||
    TestReporter(Catch::ReporterConfig&& _config):
 | 
			
		||||
        StreamingReporterBase(std::move(_config)) {
 | 
			
		||||
        std::cout << "TestReporter constructed\n";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -16,13 +16,14 @@
 | 
			
		||||
#include <catch2/reporters/catch_reporter_registrars.hpp>
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
  class TestReporter : public Catch::StreamingReporterBase {
 | 
			
		||||
  public:
 | 
			
		||||
      TestReporter(Catch::ReporterConfig const& _config):
 | 
			
		||||
          StreamingReporterBase(_config) {
 | 
			
		||||
      TestReporter(Catch::ReporterConfig&& _config):
 | 
			
		||||
          StreamingReporterBase(std::move(_config)) {
 | 
			
		||||
          m_preferences.shouldReportAllAssertions = false;
 | 
			
		||||
          std::cout << "X26 - TestReporter constructed\n";
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
class TestReporter : public Catch::StreamingReporterBase {
 | 
			
		||||
    std::string stdOutString( uint64_t iter ){
 | 
			
		||||
@@ -36,8 +37,8 @@ class TestReporter : public Catch::StreamingReporterBase {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    TestReporter( Catch::ReporterConfig const& _config ):
 | 
			
		||||
        StreamingReporterBase( _config ) {
 | 
			
		||||
    TestReporter( Catch::ReporterConfig&& _config ):
 | 
			
		||||
        StreamingReporterBase( std::move(_config) ) {
 | 
			
		||||
        m_preferences.shouldRedirectStdOut = true;
 | 
			
		||||
        std::cout << "X27 - TestReporter constructed\n";
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,9 @@
 | 
			
		||||
#include <catch2/reporters/catch_reporter_event_listener.hpp>
 | 
			
		||||
#include <catch2/reporters/catch_reporter_registrars.hpp>
 | 
			
		||||
#include <catch2/reporters/catch_reporter_streaming_base.hpp>
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
@@ -54,8 +56,8 @@ namespace {
 | 
			
		||||
 | 
			
		||||
    class TestReporter : public Catch::StreamingReporterBase {
 | 
			
		||||
    public:
 | 
			
		||||
        TestReporter( Catch::ReporterConfig const& _config ):
 | 
			
		||||
            StreamingReporterBase( _config ) {
 | 
			
		||||
        TestReporter( Catch::ReporterConfig&& _config ):
 | 
			
		||||
            StreamingReporterBase( std::move(_config) ) {
 | 
			
		||||
            std::cout << "X28 - TestReporter constructed\n";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,8 +25,8 @@
 | 
			
		||||
 | 
			
		||||
class TestReporter : public Catch::StreamingReporterBase {
 | 
			
		||||
public:
 | 
			
		||||
    TestReporter( Catch::ReporterConfig const& _config ):
 | 
			
		||||
        StreamingReporterBase( _config ) {
 | 
			
		||||
    TestReporter( Catch::ReporterConfig&& _config ):
 | 
			
		||||
        StreamingReporterBase( std::move(_config) ) {
 | 
			
		||||
        std::cout << "X29 - TestReporter constructed\n";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user