From 0f39438aaefe70a89aaee65e8ce78c490a6b03b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 17 Jun 2019 14:43:10 +0200 Subject: [PATCH] Stop checking verbosities up-front --- docs/deprecations.md | 12 ------------ include/internal/catch_interfaces_reporter.h | 1 - include/reporters/catch_reporter_bases.cpp | 4 ---- include/reporters/catch_reporter_bases.hpp | 14 -------------- include/reporters/catch_reporter_listening.cpp | 5 ----- include/reporters/catch_reporter_listening.h | 4 +--- 6 files changed, 1 insertion(+), 39 deletions(-) diff --git a/docs/deprecations.md b/docs/deprecations.md index 42f7a073..366d6426 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -29,18 +29,6 @@ method will be removed. ## Planned changes - -### Reporter verbosities - -The current implementation of verbosities, where the reporter is checked -up-front whether it supports the requested verbosity, is fundamentally -misguided and will be changed. The new implementation will no longer check -whether the specified reporter supports the requested verbosity, instead -it will be up to the reporters to deal with verbosities as they see fit -(with an expectation that unsupported verbosities will be, at most, -warnings, but not errors). - - ### Output format of `--list-*` command line parameters The various list operations will be piped through reporters. This means diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 751ef2c2..9c2b0267 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -208,7 +208,6 @@ namespace Catch { // Implementing class must also provide the following static methods: // static std::string getDescription(); - // static std::set getSupportedVerbosities() virtual ReporterPreferences getPreferences() const = 0; diff --git a/include/reporters/catch_reporter_bases.cpp b/include/reporters/catch_reporter_bases.cpp index fcbafef5..ae704ab2 100644 --- a/include/reporters/catch_reporter_bases.cpp +++ b/include/reporters/catch_reporter_bases.cpp @@ -59,10 +59,6 @@ namespace Catch { TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) :StreamingReporterBase(_config) {} - std::set TestEventListenerBase::getSupportedVerbosities() { - return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High }; - } - void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} bool TestEventListenerBase::assertionEnded(AssertionStats const &) { diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index 66a891ff..7bedd086 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -35,18 +35,12 @@ namespace Catch { stream( _config.stream() ) { m_reporterPrefs.shouldRedirectStdOut = false; - if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) - CATCH_ERROR( "Verbosity level not supported by this reporter" ); } ReporterPreferences getPreferences() const override { return m_reporterPrefs; } - static std::set getSupportedVerbosities() { - return { Verbosity::Normal }; - } - ~StreamingReporterBase() override = default; void noMatchingTestCases(std::string const&) override {} @@ -153,8 +147,6 @@ namespace Catch { stream( _config.stream() ) { m_reporterPrefs.shouldRedirectStdOut = false; - if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) - CATCH_ERROR( "Verbosity level not supported by this reporter" ); } ~CumulativeReporterBase() override = default; @@ -162,10 +154,6 @@ namespace Catch { return m_reporterPrefs; } - static std::set getSupportedVerbosities() { - return { Verbosity::Normal }; - } - void testRunStarting( TestRunInfo const& ) override {} void testGroupStarting( GroupInfo const& ) override {} @@ -271,8 +259,6 @@ namespace Catch { struct TestEventListenerBase : StreamingReporterBase { TestEventListenerBase( ReporterConfig const& _config ); - static std::set getSupportedVerbosities(); - void assertionStarting(AssertionInfo const&) override; bool assertionEnded(AssertionStats const&) override; }; diff --git a/include/reporters/catch_reporter_listening.cpp b/include/reporters/catch_reporter_listening.cpp index 91e6b39a..32ee54ac 100644 --- a/include/reporters/catch_reporter_listening.cpp +++ b/include/reporters/catch_reporter_listening.cpp @@ -30,11 +30,6 @@ namespace Catch { return m_preferences; } - std::set ListeningReporter::getSupportedVerbosities() { - return std::set{ }; - } - - void ListeningReporter::noMatchingTestCases( std::string const& spec ) { for ( auto const& listener : m_listeners ) { listener->noMatchingTestCases( spec ); diff --git a/include/reporters/catch_reporter_listening.h b/include/reporters/catch_reporter_listening.h index bfaa3085..7fbd7af5 100644 --- a/include/reporters/catch_reporter_listening.h +++ b/include/reporters/catch_reporter_listening.h @@ -28,10 +28,8 @@ namespace Catch { ReporterPreferences getPreferences() const override; void noMatchingTestCases( std::string const& spec ) override; - + void reportInvalidArguments(std::string const&arg) override; - - static std::set getSupportedVerbosities(); #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) void benchmarkPreparing(std::string const& name) override;