Stop checking verbosities up-front

This commit is contained in:
Martin Hořeňovský 2019-06-17 14:43:10 +02:00
parent c582e351ce
commit 0f39438aae
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
6 changed files with 1 additions and 39 deletions

View File

@ -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

View File

@ -208,7 +208,6 @@ namespace Catch {
// Implementing class must also provide the following static methods:
// static std::string getDescription();
// static std::set<Verbosity> getSupportedVerbosities()
virtual ReporterPreferences getPreferences() const = 0;

View File

@ -59,10 +59,6 @@ namespace Catch {
TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
:StreamingReporterBase(_config) {}
std::set<Verbosity> TestEventListenerBase::getSupportedVerbosities() {
return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High };
}
void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}
bool TestEventListenerBase::assertionEnded(AssertionStats const &) {

View File

@ -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<Verbosity> 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<Verbosity> getSupportedVerbosities() {
return { Verbosity::Normal };
}
void testRunStarting( TestRunInfo const& ) override {}
void testGroupStarting( GroupInfo const& ) override {}
@ -271,8 +259,6 @@ namespace Catch {
struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
TestEventListenerBase( ReporterConfig const& _config );
static std::set<Verbosity> getSupportedVerbosities();
void assertionStarting(AssertionInfo const&) override;
bool assertionEnded(AssertionStats const&) override;
};

View File

@ -30,11 +30,6 @@ namespace Catch {
return m_preferences;
}
std::set<Verbosity> ListeningReporter::getSupportedVerbosities() {
return std::set<Verbosity>{ };
}
void ListeningReporter::noMatchingTestCases( std::string const& spec ) {
for ( auto const& listener : m_listeners ) {
listener->noMatchingTestCases( spec );

View File

@ -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<Verbosity> getSupportedVerbosities();
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
void benchmarkPreparing(std::string const& name) override;