removed redundant virtuals on override functions (and added a couple of overrides)

This commit is contained in:
Phil Nash 2017-07-20 15:57:17 +01:00
parent 74ab1cd94b
commit f0890dcdf8
23 changed files with 183 additions and 206 deletions

View File

@ -80,19 +80,19 @@ namespace Catch {
bool showHelp() const; bool showHelp() const;
// IConfig interface // IConfig interface
virtual bool allowThrows() const override; bool allowThrows() const override;
virtual std::ostream& stream() const override; std::ostream& stream() const override;
virtual std::string name() const override; std::string name() const override;
virtual bool includeSuccessfulResults() const override; bool includeSuccessfulResults() const override;
virtual bool warnAboutMissingAssertions() const override; bool warnAboutMissingAssertions() const override;
virtual ShowDurations::OrNot showDurations() const override; ShowDurations::OrNot showDurations() const override;
virtual RunTests::InWhatOrder runOrder() const override; RunTests::InWhatOrder runOrder() const override;
virtual unsigned int rngSeed() const override; unsigned int rngSeed() const override;
virtual UseColour::YesOrNo useColour() const override; UseColour::YesOrNo useColour() const override;
virtual bool shouldDebugBreak() const override; bool shouldDebugBreak() const override;
virtual int abortAfter() const override; int abortAfter() const override;
virtual bool showInvisibles() const override; bool showInvisibles() const override;
virtual Verbosity verbosity() const override; Verbosity verbosity() const override;
private: private:

View File

@ -81,7 +81,7 @@ public:
.endExpression( *this ); .endExpression( *this );
} }
virtual void reconstructExpression( std::string& dest ) const override { void reconstructExpression( std::string& dest ) const override {
dest = ::Catch::Detail::stringify( m_lhs ); dest = ::Catch::Detail::stringify( m_lhs );
} }
@ -117,11 +117,11 @@ public:
.endExpression( *this ); .endExpression( *this );
} }
virtual bool isBinaryExpression() const override { bool isBinaryExpression() const override {
return true; return true;
} }
virtual void reconstructExpression( std::string& dest ) const override { void reconstructExpression( std::string& dest ) const override {
std::string lhs = ::Catch::Detail::stringify( m_lhs ); std::string lhs = ::Catch::Detail::stringify( m_lhs );
std::string rhs = ::Catch::Detail::stringify( m_rhs ); std::string rhs = ::Catch::Detail::stringify( m_rhs );
char delim = lhs.size() + rhs.size() < 40 && char delim = lhs.size() + rhs.size() < 40 &&
@ -151,11 +151,11 @@ public:
MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString ) MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString )
: m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {} : m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {}
virtual bool isBinaryExpression() const override { bool isBinaryExpression() const override {
return true; return true;
} }
virtual void reconstructExpression( std::string& dest ) const override { void reconstructExpression( std::string& dest ) const override {
std::string matcherAsString = m_matcher.toString(); std::string matcherAsString = m_matcher.toString();
dest = ::Catch::Detail::stringify( m_arg ); dest = ::Catch::Detail::stringify( m_arg );
dest += ' '; dest += ' ';

View File

@ -53,14 +53,14 @@ namespace Matchers {
template<typename ArgT> template<typename ArgT>
struct MatchAllOf : MatcherBase<ArgT> { struct MatchAllOf : MatcherBase<ArgT> {
virtual bool match( ArgT const& arg ) const override { bool match( ArgT const& arg ) const override {
for( auto matcher : m_matchers ) { for( auto matcher : m_matchers ) {
if (!matcher->match(arg)) if (!matcher->match(arg))
return false; return false;
} }
return true; return true;
} }
virtual std::string describe() const override { std::string describe() const override {
std::string description; std::string description;
description.reserve( 4 + m_matchers.size()*32 ); description.reserve( 4 + m_matchers.size()*32 );
description += "( "; description += "( ";
@ -86,14 +86,14 @@ namespace Matchers {
template<typename ArgT> template<typename ArgT>
struct MatchAnyOf : MatcherBase<ArgT> { struct MatchAnyOf : MatcherBase<ArgT> {
virtual bool match( ArgT const& arg ) const override { bool match( ArgT const& arg ) const override {
for( auto matcher : m_matchers ) { for( auto matcher : m_matchers ) {
if (matcher->match(arg)) if (matcher->match(arg))
return true; return true;
} }
return false; return false;
} }
virtual std::string describe() const override { std::string describe() const override {
std::string description; std::string description;
description.reserve( 4 + m_matchers.size()*32 ); description.reserve( 4 + m_matchers.size()*32 );
description += "( "; description += "( ";
@ -122,11 +122,11 @@ namespace Matchers {
MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
virtual bool match( ArgT const& arg ) const override { bool match( ArgT const& arg ) const override {
return !m_underlyingMatcher.match( arg ); return !m_underlyingMatcher.match( arg );
} }
virtual std::string describe() const override { std::string describe() const override {
return "not " + m_underlyingMatcher.toString(); return "not " + m_underlyingMatcher.toString();
} }
MatcherBase<ArgT> const& m_underlyingMatcher; MatcherBase<ArgT> const& m_underlyingMatcher;

View File

@ -29,7 +29,7 @@ namespace Matchers {
struct StringMatcherBase : MatcherBase<std::string> { struct StringMatcherBase : MatcherBase<std::string> {
StringMatcherBase( std::string const& operation, CasedString const& comparator ); StringMatcherBase( std::string const& operation, CasedString const& comparator );
virtual std::string describe() const override; std::string describe() const override;
CasedString m_comparator; CasedString m_comparator;
std::string m_operation; std::string m_operation;
@ -37,19 +37,19 @@ namespace Matchers {
struct EqualsMatcher : StringMatcherBase { struct EqualsMatcher : StringMatcherBase {
EqualsMatcher( CasedString const& comparator ); EqualsMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const override; bool match( std::string const& source ) const override;
}; };
struct ContainsMatcher : StringMatcherBase { struct ContainsMatcher : StringMatcherBase {
ContainsMatcher( CasedString const& comparator ); ContainsMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const override; bool match( std::string const& source ) const override;
}; };
struct StartsWithMatcher : StringMatcherBase { struct StartsWithMatcher : StringMatcherBase {
StartsWithMatcher( CasedString const& comparator ); StartsWithMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const override; bool match( std::string const& source ) const override;
}; };
struct EndsWithMatcher : StringMatcherBase { struct EndsWithMatcher : StringMatcherBase {
EndsWithMatcher( CasedString const& comparator ); EndsWithMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const override; bool match( std::string const& source ) const override;
}; };
} // namespace StdString } // namespace StdString

View File

@ -24,7 +24,7 @@ namespace Matchers {
return std::find(v.begin(), v.end(), m_comparator) != v.end(); return std::find(v.begin(), v.end(), m_comparator) != v.end();
} }
virtual std::string describe() const override { std::string describe() const override {
return "Contains: " + ::Catch::Detail::stringify( m_comparator ); return "Contains: " + ::Catch::Detail::stringify( m_comparator );
} }
@ -45,7 +45,7 @@ namespace Matchers {
return false; return false;
return true; return true;
} }
virtual std::string describe() const override { std::string describe() const override {
return "Contains: " + ::Catch::Detail::stringify( m_comparator ); return "Contains: " + ::Catch::Detail::stringify( m_comparator );
} }
@ -69,7 +69,7 @@ namespace Matchers {
return false; return false;
return true; return true;
} }
virtual std::string describe() const override { std::string describe() const override {
return "Equals: " + ::Catch::Detail::stringify( m_comparator ); return "Equals: " + ::Catch::Detail::stringify( m_comparator );
} }
std::vector<T> const& m_comparator; std::vector<T> const& m_comparator;

View File

@ -112,7 +112,7 @@ namespace Catch {
arcSafeRelease( m_substr ); arcSafeRelease( m_substr );
} }
virtual bool match( NSString* arg ) const override { bool match( NSString* arg ) const override {
return false; return false;
} }
@ -122,12 +122,12 @@ namespace Catch {
struct Equals : StringHolder { struct Equals : StringHolder {
Equals( NSString* substr ) : StringHolder( substr ){} Equals( NSString* substr ) : StringHolder( substr ){}
virtual bool match( NSString* str ) const override { bool match( NSString* str ) const override {
return (str != nil || m_substr == nil ) && return (str != nil || m_substr == nil ) &&
[str isEqualToString:m_substr]; [str isEqualToString:m_substr];
} }
virtual std::string describe() const override { std::string describe() const override {
return "equals string: " + Catch::toString( m_substr ); return "equals string: " + Catch::toString( m_substr );
} }
}; };
@ -135,12 +135,12 @@ namespace Catch {
struct Contains : StringHolder { struct Contains : StringHolder {
Contains( NSString* substr ) : StringHolder( substr ){} Contains( NSString* substr ) : StringHolder( substr ){}
virtual bool match( NSString* str ) const { bool match( NSString* str ) const {
return (str != nil || m_substr == nil ) && return (str != nil || m_substr == nil ) &&
[str rangeOfString:m_substr].location != NSNotFound; [str rangeOfString:m_substr].location != NSNotFound;
} }
virtual std::string describe() const override { std::string describe() const override {
return "contains string: " + Catch::toString( m_substr ); return "contains string: " + Catch::toString( m_substr );
} }
}; };
@ -148,24 +148,24 @@ namespace Catch {
struct StartsWith : StringHolder { struct StartsWith : StringHolder {
StartsWith( NSString* substr ) : StringHolder( substr ){} StartsWith( NSString* substr ) : StringHolder( substr ){}
virtual bool match( NSString* str ) const { bool match( NSString* str ) const override {
return (str != nil || m_substr == nil ) && return (str != nil || m_substr == nil ) &&
[str rangeOfString:m_substr].location == 0; [str rangeOfString:m_substr].location == 0;
} }
virtual std::string describe() const override { std::string describe() const override {
return "starts with: " + Catch::toString( m_substr ); return "starts with: " + Catch::toString( m_substr );
} }
}; };
struct EndsWith : StringHolder { struct EndsWith : StringHolder {
EndsWith( NSString* substr ) : StringHolder( substr ){} EndsWith( NSString* substr ) : StringHolder( substr ){}
virtual bool match( NSString* str ) const { bool match( NSString* str ) const override {
return (str != nil || m_substr == nil ) && return (str != nil || m_substr == nil ) &&
[str rangeOfString:m_substr].location == [str length] - [m_substr length]; [str rangeOfString:m_substr].location == [str length] - [m_substr length];
} }
virtual std::string describe() const override { std::string describe() const override {
return "ends with: " + Catch::toString( m_substr ); return "ends with: " + Catch::toString( m_substr );
} }
}; };

View File

@ -24,39 +24,39 @@ namespace Catch {
public: // IRegistryHub public: // IRegistryHub
RegistryHub() { RegistryHub() {
} }
virtual IReporterRegistry const& getReporterRegistry() const override { IReporterRegistry const& getReporterRegistry() const override {
return m_reporterRegistry; return m_reporterRegistry;
} }
virtual ITestCaseRegistry const& getTestCaseRegistry() const override { ITestCaseRegistry const& getTestCaseRegistry() const override {
return m_testCaseRegistry; return m_testCaseRegistry;
} }
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override { IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {
return m_exceptionTranslatorRegistry; return m_exceptionTranslatorRegistry;
} }
virtual ITagAliasRegistry const& getTagAliasRegistry() const override { ITagAliasRegistry const& getTagAliasRegistry() const override {
return m_tagAliasRegistry; return m_tagAliasRegistry;
} }
virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const override { StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
return m_exceptionRegistry; return m_exceptionRegistry;
} }
public: // IMutableRegistryHub public: // IMutableRegistryHub
virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
m_reporterRegistry.registerReporter( name, factory ); m_reporterRegistry.registerReporter( name, factory );
} }
virtual void registerListener( IReporterFactoryPtr const& factory ) override { void registerListener( IReporterFactoryPtr const& factory ) override {
m_reporterRegistry.registerListener( factory ); m_reporterRegistry.registerListener( factory );
} }
virtual void registerTest( TestCase const& testInfo ) override { void registerTest( TestCase const& testInfo ) override {
m_testCaseRegistry.registerTest( testInfo ); m_testCaseRegistry.registerTest( testInfo );
} }
virtual void registerTranslator( const IExceptionTranslator* translator ) override { void registerTranslator( const IExceptionTranslator* translator ) override {
m_exceptionTranslatorRegistry.registerTranslator( translator ); m_exceptionTranslatorRegistry.registerTranslator( translator );
} }
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
m_tagAliasRegistry.add( alias, tag, lineInfo ); m_tagAliasRegistry.add( alias, tag, lineInfo );
} }
virtual void registerStartupException( std::exception_ptr const& exception ) noexcept override { void registerStartupException( std::exception_ptr const& exception ) noexcept override {
m_exceptionRegistry.add(exception); m_exceptionRegistry.add(exception);
} }

View File

@ -18,9 +18,9 @@ namespace Catch {
public: public:
virtual ~ReporterRegistry() override {} ~ReporterRegistry() override {}
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override { IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
FactoryMap::const_iterator it = m_factories.find( name ); FactoryMap::const_iterator it = m_factories.find( name );
if( it == m_factories.end() ) if( it == m_factories.end() )
return nullptr; return nullptr;
@ -34,10 +34,10 @@ namespace Catch {
m_listeners.push_back( factory ); m_listeners.push_back( factory );
} }
virtual FactoryMap const& getFactories() const override { FactoryMap const& getFactories() const override {
return m_factories; return m_factories;
} }
virtual Listeners const& getListeners() const override { Listeners const& getListeners() const override {
return m_listeners; return m_listeners;
} }

View File

@ -50,7 +50,7 @@ namespace Catch {
void endExpression( DecomposedExpression const& expr ); void endExpression( DecomposedExpression const& expr );
virtual void reconstructExpression( std::string& dest ) const override; void reconstructExpression( std::string& dest ) const override;
AssertionResult build() const; AssertionResult build() const;
AssertionResult build( DecomposedExpression const& expr ) const; AssertionResult build( DecomposedExpression const& expr ) const;

View File

@ -31,9 +31,9 @@ namespace Catch {
mutable std::ofstream m_ofs; mutable std::ofstream m_ofs;
public: public:
FileStream( std::string const& filename ); FileStream( std::string const& filename );
virtual ~FileStream() noexcept; ~FileStream() noexcept override;
public: // IStream public: // IStream
virtual std::ostream& stream() const override; std::ostream& stream() const override;
}; };
@ -41,10 +41,10 @@ namespace Catch {
mutable std::ostream m_os; mutable std::ostream m_os;
public: public:
CoutStream(); CoutStream();
virtual ~CoutStream() noexcept; ~CoutStream() noexcept override;
public: // IStream public: // IStream
virtual std::ostream& stream() const override; std::ostream& stream() const override;
}; };
@ -53,10 +53,10 @@ namespace Catch {
mutable std::ostream m_os; mutable std::ostream m_os;
public: public:
DebugOutStream(); DebugOutStream();
virtual ~DebugOutStream() noexcept; ~DebugOutStream() noexcept override;
public: // IStream public: // IStream
virtual std::ostream& stream() const override; std::ostream& stream() const override;
}; };
} }

View File

@ -16,9 +16,9 @@ namespace Catch {
class TagAliasRegistry : public ITagAliasRegistry { class TagAliasRegistry : public ITagAliasRegistry {
public: public:
virtual ~TagAliasRegistry(); ~TagAliasRegistry() override;
virtual Option<TagAlias> find( std::string const& alias ) const; Option<TagAlias> find( std::string const& alias ) const override;
virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const; std::string expandAliases( std::string const& unexpandedTestSpec ) const override;
void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );
private: private:

View File

@ -96,10 +96,10 @@ namespace Catch {
m_functions.push_back( testCase ); m_functions.push_back( testCase );
} }
virtual std::vector<TestCase> const& getAllTests() const { std::vector<TestCase> const& getAllTests() const override {
return m_functions; return m_functions;
} }
virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const { std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override {
if( m_sortedFunctions.empty() ) if( m_sortedFunctions.empty() )
enforceNoDuplicateTestCases( m_functions ); enforceNoDuplicateTestCases( m_functions );

View File

@ -59,7 +59,7 @@ namespace TestCaseTracking {
virtual bool isIndexTracker() const = 0; virtual bool isIndexTracker() const = 0;
}; };
class TrackerContext { class TrackerContext {
enum RunState { enum RunState {
NotStarted, NotStarted,
@ -113,30 +113,29 @@ namespace TestCaseTracking {
public: public:
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
virtual ~TrackerBase() = default;
virtual NameAndLocation const& nameAndLocation() const override; NameAndLocation const& nameAndLocation() const override;
virtual bool isComplete() const override; bool isComplete() const override;
virtual bool isSuccessfullyCompleted() const override; bool isSuccessfullyCompleted() const override;
virtual bool isOpen() const override; bool isOpen() const override;
virtual bool hasChildren() const override; bool hasChildren() const override;
virtual void addChild( ITrackerPtr const& child ) override; void addChild( ITrackerPtr const& child ) override;
virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;
virtual ITracker& parent() override; ITracker& parent() override;
virtual void openChild() override; void openChild() override;
virtual bool isSectionTracker() const override; bool isSectionTracker() const override;
virtual bool isIndexTracker() const override; bool isIndexTracker() const override;
void open(); void open();
virtual void close() override; void close() override;
virtual void fail() override; void fail() override;
virtual void markAsNeedingAnotherRun() override; void markAsNeedingAnotherRun() override;
private: private:
void moveToParent(); void moveToParent();
@ -147,9 +146,8 @@ namespace TestCaseTracking {
std::vector<std::string> m_filters; std::vector<std::string> m_filters;
public: public:
SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
virtual ~SectionTracker() = default;
virtual bool isSectionTracker() const override; bool isSectionTracker() const override;
static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );
@ -164,17 +162,15 @@ namespace TestCaseTracking {
int m_index = -1; int m_index = -1;
public: public:
IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ); IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size );
virtual ~IndexTracker() = default;
virtual bool isIndexTracker() const override; bool isIndexTracker() const override;
void close() override;
static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ); static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size );
int index() const; int index() const;
void moveNext(); void moveNext();
virtual void close() override;
}; };
} // namespace TestCaseTracking } // namespace TestCaseTracking

View File

@ -21,17 +21,17 @@ namespace Catch {
: StreamingReporterBase( _config ) : StreamingReporterBase( _config )
{} {}
virtual ~AutomakeReporter(); ~AutomakeReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in the format of Automake .trs files"; return "Reports test results in the format of Automake .trs files";
} }
virtual void assertionStarting( AssertionInfo const& ) override {} void assertionStarting( AssertionInfo const& ) override {}
virtual bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; } bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; }
virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) override { void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
// Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR.
stream << ":test-result: "; stream << ":test-result: ";
if (_testCaseStats.totals.assertions.allPassed()) { if (_testCaseStats.totals.assertions.allPassed()) {
@ -45,7 +45,7 @@ namespace Catch {
StreamingReporterBase::testCaseEnded( _testCaseStats ); StreamingReporterBase::testCaseEnded( _testCaseStats );
} }
virtual void skipTest( TestCaseInfo const& testInfo ) override { void skipTest( TestCaseInfo const& testInfo ) override {
stream << ":test-result: SKIP " << testInfo.name << '\n'; stream << ":test-result: SKIP " << testInfo.name << '\n';
} }

View File

@ -32,7 +32,7 @@ namespace Catch {
CATCH_ENFORCE( DerivedT::getSupportedVerbosities().count( m_config->verbosity() ), "Verbosity level not supported by this reporter" ); CATCH_ENFORCE( DerivedT::getSupportedVerbosities().count( m_config->verbosity() ), "Verbosity level not supported by this reporter" );
} }
virtual ReporterPreferences getPreferences() const override { ReporterPreferences getPreferences() const override {
return m_reporterPrefs; return m_reporterPrefs;
} }
@ -40,40 +40,40 @@ namespace Catch {
return { Verbosity::Normal }; return { Verbosity::Normal };
} }
virtual ~StreamingReporterBase() override = default; ~StreamingReporterBase() override = default;
virtual void noMatchingTestCases(std::string const&) override {} void noMatchingTestCases(std::string const&) override {}
virtual void testRunStarting(TestRunInfo const& _testRunInfo) override { void testRunStarting(TestRunInfo const& _testRunInfo) override {
currentTestRunInfo = _testRunInfo; currentTestRunInfo = _testRunInfo;
} }
virtual void testGroupStarting(GroupInfo const& _groupInfo) override { void testGroupStarting(GroupInfo const& _groupInfo) override {
currentGroupInfo = _groupInfo; currentGroupInfo = _groupInfo;
} }
virtual void testCaseStarting(TestCaseInfo const& _testInfo) override { void testCaseStarting(TestCaseInfo const& _testInfo) override {
currentTestCaseInfo = _testInfo; currentTestCaseInfo = _testInfo;
} }
virtual void sectionStarting(SectionInfo const& _sectionInfo) override { void sectionStarting(SectionInfo const& _sectionInfo) override {
m_sectionStack.push_back(_sectionInfo); m_sectionStack.push_back(_sectionInfo);
} }
virtual void sectionEnded(SectionStats const& /* _sectionStats */) override { void sectionEnded(SectionStats const& /* _sectionStats */) override {
m_sectionStack.pop_back(); m_sectionStack.pop_back();
} }
virtual void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
currentTestCaseInfo.reset(); currentTestCaseInfo.reset();
} }
virtual void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {
currentGroupInfo.reset(); currentGroupInfo.reset();
} }
virtual void testRunEnded(TestRunStats const& /* _testRunStats */) override { void testRunEnded(TestRunStats const& /* _testRunStats */) override {
currentTestCaseInfo.reset(); currentTestCaseInfo.reset();
currentGroupInfo.reset(); currentGroupInfo.reset();
currentTestRunInfo.reset(); currentTestRunInfo.reset();
} }
virtual void skipTest(TestCaseInfo const&) override { void skipTest(TestCaseInfo const&) override {
// Don't do anything with this by default. // Don't do anything with this by default.
// It can optionally be overridden in the derived class. // It can optionally be overridden in the derived class.
} }
@ -144,9 +144,9 @@ namespace Catch {
m_reporterPrefs.shouldRedirectStdOut = false; m_reporterPrefs.shouldRedirectStdOut = false;
CATCH_ENFORCE( DerivedT::getSupportedVerbosities().count( m_config->verbosity() ), "Verbosity level not supported by this reporter" ); CATCH_ENFORCE( DerivedT::getSupportedVerbosities().count( m_config->verbosity() ), "Verbosity level not supported by this reporter" );
} }
virtual ~CumulativeReporterBase() = default; ~CumulativeReporterBase() override = default;
virtual ReporterPreferences getPreferences() const override { ReporterPreferences getPreferences() const override {
return m_reporterPrefs; return m_reporterPrefs;
} }
@ -154,12 +154,12 @@ namespace Catch {
return { Verbosity::Normal }; return { Verbosity::Normal };
} }
virtual void testRunStarting( TestRunInfo const& ) override {} void testRunStarting( TestRunInfo const& ) override {}
virtual void testGroupStarting( GroupInfo const& ) override {} void testGroupStarting( GroupInfo const& ) override {}
virtual void testCaseStarting( TestCaseInfo const& ) override {} void testCaseStarting( TestCaseInfo const& ) override {}
virtual void sectionStarting( SectionInfo const& sectionInfo ) override { void sectionStarting( SectionInfo const& sectionInfo ) override {
SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
std::shared_ptr<SectionNode> node; std::shared_ptr<SectionNode> node;
if( m_sectionStack.empty() ) { if( m_sectionStack.empty() ) {
@ -184,9 +184,9 @@ namespace Catch {
m_deepestSection = node; m_deepestSection = node;
} }
virtual void assertionStarting(AssertionInfo const&) override {} void assertionStarting(AssertionInfo const&) override {}
virtual bool assertionEnded(AssertionStats const& assertionStats) override { bool assertionEnded(AssertionStats const& assertionStats) override {
assert(!m_sectionStack.empty()); assert(!m_sectionStack.empty());
SectionNode& sectionNode = *m_sectionStack.back(); SectionNode& sectionNode = *m_sectionStack.back();
sectionNode.assertions.push_back(assertionStats); sectionNode.assertions.push_back(assertionStats);
@ -198,13 +198,13 @@ namespace Catch {
prepareExpandedExpression(sectionNode.assertions.back().assertionResult); prepareExpandedExpression(sectionNode.assertions.back().assertionResult);
return true; return true;
} }
virtual void sectionEnded(SectionStats const& sectionStats) override { void sectionEnded(SectionStats const& sectionStats) override {
assert(!m_sectionStack.empty()); assert(!m_sectionStack.empty());
SectionNode& node = *m_sectionStack.back(); SectionNode& node = *m_sectionStack.back();
node.stats = sectionStats; node.stats = sectionStats;
m_sectionStack.pop_back(); m_sectionStack.pop_back();
} }
virtual void testCaseEnded(TestCaseStats const& testCaseStats) override { void testCaseEnded(TestCaseStats const& testCaseStats) override {
auto node = std::make_shared<TestCaseNode>(testCaseStats); auto node = std::make_shared<TestCaseNode>(testCaseStats);
assert(m_sectionStack.size() == 0); assert(m_sectionStack.size() == 0);
node->children.push_back(m_rootSection); node->children.push_back(m_rootSection);
@ -215,12 +215,12 @@ namespace Catch {
m_deepestSection->stdOut = testCaseStats.stdOut; m_deepestSection->stdOut = testCaseStats.stdOut;
m_deepestSection->stdErr = testCaseStats.stdErr; m_deepestSection->stdErr = testCaseStats.stdErr;
} }
virtual void testGroupEnded(TestGroupStats const& testGroupStats) override { void testGroupEnded(TestGroupStats const& testGroupStats) override {
auto node = std::make_shared<TestGroupNode>(testGroupStats); auto node = std::make_shared<TestGroupNode>(testGroupStats);
node->children.swap(m_testCases); node->children.swap(m_testCases);
m_testGroups.push_back(node); m_testGroups.push_back(node);
} }
virtual void testRunEnded(TestRunStats const& testRunStats) override { void testRunEnded(TestRunStats const& testRunStats) override {
auto node = std::make_shared<TestRunNode>(testRunStats); auto node = std::make_shared<TestRunNode>(testRunStats);
node->children.swap(m_testGroups); node->children.swap(m_testGroups);
m_testRuns.push_back(node); m_testRuns.push_back(node);
@ -228,9 +228,9 @@ namespace Catch {
} }
virtual void testRunEndedCumulative() = 0; virtual void testRunEndedCumulative() = 0;
virtual void skipTest(TestCaseInfo const&) override {} void skipTest(TestCaseInfo const&) override {}
virtual void prepareExpandedExpression(AssertionResult& result) const { void prepareExpandedExpression(AssertionResult& result) const {
if (result.isOk()) if (result.isOk())
result.discardDecomposedExpression(); result.discardDecomposedExpression();
else else
@ -266,8 +266,8 @@ namespace Catch {
struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> { struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
TestEventListenerBase( ReporterConfig const& _config ); TestEventListenerBase( ReporterConfig const& _config );
virtual void assertionStarting(AssertionInfo const&) override; void assertionStarting(AssertionInfo const&) override;
virtual bool assertionEnded(AssertionStats const&) override; bool assertionEnded(AssertionStats const&) override;
}; };
} // end namespace Catch } // end namespace Catch

View File

@ -17,7 +17,7 @@ namespace Catch {
using StreamingReporterBase::StreamingReporterBase; using StreamingReporterBase::StreamingReporterBase;
virtual ~CompactReporter(); ~CompactReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results on a single line, suitable for IDEs"; return "Reports test results on a single line, suitable for IDEs";
@ -54,7 +54,7 @@ namespace Catch {
return true; return true;
} }
virtual void sectionEnded(SectionStats const& _sectionStats) override { void sectionEnded(SectionStats const& _sectionStats) override {
if (m_config->showDurations() == ShowDurations::Always) { if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
} }
@ -73,7 +73,6 @@ namespace Catch {
AssertionPrinter( AssertionPrinter const& ) = delete; AssertionPrinter( AssertionPrinter const& ) = delete;
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages ) AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages )
: stream( _stream ) : stream( _stream )
, stats( _stats )
, result( _stats.assertionResult ) , result( _stats.assertionResult )
, messages( _stats.infoMessages ) , messages( _stats.infoMessages )
, itMessage( _stats.infoMessages.begin() ) , itMessage( _stats.infoMessages.begin() )
@ -241,7 +240,6 @@ namespace Catch {
private: private:
std::ostream& stream; std::ostream& stream;
AssertionStats const& stats;
AssertionResult const& result; AssertionResult const& result;
std::vector<MessageInfo> messages; std::vector<MessageInfo> messages;
std::vector<MessageInfo>::const_iterator itMessage; std::vector<MessageInfo>::const_iterator itMessage;

View File

@ -22,19 +22,18 @@ namespace Catch {
using StreamingReporterBase::StreamingReporterBase; using StreamingReporterBase::StreamingReporterBase;
virtual ~ConsoleReporter() override; ~ConsoleReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as plain lines of text"; return "Reports test results as plain lines of text";
} }
virtual void noMatchingTestCases( std::string const& spec ) override { void noMatchingTestCases( std::string const& spec ) override {
stream << "No test cases matched '" << spec << '\'' << std::endl; stream << "No test cases matched '" << spec << '\'' << std::endl;
} }
virtual void assertionStarting( AssertionInfo const& ) override { void assertionStarting( AssertionInfo const& ) override {}
}
virtual bool assertionEnded( AssertionStats const& _assertionStats ) override { bool assertionEnded( AssertionStats const& _assertionStats ) override {
AssertionResult const& result = _assertionStats.assertionResult; AssertionResult const& result = _assertionStats.assertionResult;
bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
@ -51,11 +50,11 @@ namespace Catch {
return true; return true;
} }
virtual void sectionStarting( SectionInfo const& _sectionInfo ) override { void sectionStarting( SectionInfo const& _sectionInfo ) override {
m_headerPrinted = false; m_headerPrinted = false;
StreamingReporterBase::sectionStarting( _sectionInfo ); StreamingReporterBase::sectionStarting( _sectionInfo );
} }
virtual void sectionEnded( SectionStats const& _sectionStats ) override { void sectionEnded( SectionStats const& _sectionStats ) override {
if( _sectionStats.missingAssertions ) { if( _sectionStats.missingAssertions ) {
lazyPrint(); lazyPrint();
Colour colour( Colour::ResultError ); Colour colour( Colour::ResultError );
@ -74,11 +73,11 @@ namespace Catch {
StreamingReporterBase::sectionEnded( _sectionStats ); StreamingReporterBase::sectionEnded( _sectionStats );
} }
virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) override { void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
StreamingReporterBase::testCaseEnded( _testCaseStats ); StreamingReporterBase::testCaseEnded( _testCaseStats );
m_headerPrinted = false; m_headerPrinted = false;
} }
virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) override { void testGroupEnded( TestGroupStats const& _testGroupStats ) override {
if( currentGroupInfo.used ) { if( currentGroupInfo.used ) {
printSummaryDivider(); printSummaryDivider();
stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
@ -87,7 +86,7 @@ namespace Catch {
} }
StreamingReporterBase::testGroupEnded( _testGroupStats ); StreamingReporterBase::testGroupEnded( _testGroupStats );
} }
virtual void testRunEnded( TestRunStats const& _testRunStats ) override { void testRunEnded( TestRunStats const& _testRunStats ) override {
printTotalsDivider( _testRunStats.totals ); printTotalsDivider( _testRunStats.totals );
printTotals( _testRunStats.totals ); printTotals( _testRunStats.totals );
stream << std::endl; stream << std::endl;

View File

@ -57,20 +57,20 @@ namespace Catch {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }
virtual ~JunitReporter() override; ~JunitReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in an XML format that looks like Ant's junitreport target"; return "Reports test results in an XML format that looks like Ant's junitreport target";
} }
virtual void noMatchingTestCases( std::string const& /*spec*/ ) override {} void noMatchingTestCases( std::string const& /*spec*/ ) override {}
virtual void testRunStarting( TestRunInfo const& runInfo ) override { void testRunStarting( TestRunInfo const& runInfo ) override {
CumulativeReporterBase::testRunStarting( runInfo ); CumulativeReporterBase::testRunStarting( runInfo );
xml.startElement( "testsuites" ); xml.startElement( "testsuites" );
} }
virtual void testGroupStarting( GroupInfo const& groupInfo ) override { void testGroupStarting( GroupInfo const& groupInfo ) override {
suiteTimer.start(); suiteTimer.start();
stdOutForSuite.str(""); stdOutForSuite.str("");
stdErrForSuite.str(""); stdErrForSuite.str("");
@ -78,28 +78,28 @@ namespace Catch {
CumulativeReporterBase::testGroupStarting( groupInfo ); CumulativeReporterBase::testGroupStarting( groupInfo );
} }
virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) override { void testCaseStarting( TestCaseInfo const& testCaseInfo ) override {
m_okToFail = testCaseInfo.okToFail(); m_okToFail = testCaseInfo.okToFail();
} }
virtual bool assertionEnded( AssertionStats const& assertionStats ) override { bool assertionEnded( AssertionStats const& assertionStats ) override {
if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
unexpectedExceptions++; unexpectedExceptions++;
return CumulativeReporterBase::assertionEnded( assertionStats ); return CumulativeReporterBase::assertionEnded( assertionStats );
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { void testCaseEnded( TestCaseStats const& testCaseStats ) override {
stdOutForSuite << testCaseStats.stdOut; stdOutForSuite << testCaseStats.stdOut;
stdErrForSuite << testCaseStats.stdErr; stdErrForSuite << testCaseStats.stdErr;
CumulativeReporterBase::testCaseEnded( testCaseStats ); CumulativeReporterBase::testCaseEnded( testCaseStats );
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { void testGroupEnded( TestGroupStats const& testGroupStats ) override {
double suiteTime = suiteTimer.getElapsedSeconds(); double suiteTime = suiteTimer.getElapsedSeconds();
CumulativeReporterBase::testGroupEnded( testGroupStats ); CumulativeReporterBase::testGroupEnded( testGroupStats );
writeGroup( *m_testGroups.back(), suiteTime ); writeGroup( *m_testGroups.back(), suiteTime );
} }
virtual void testRunEndedCumulative() override { void testRunEndedCumulative() override {
xml.endElement(); xml.endElement();
} }

View File

@ -18,40 +18,27 @@ namespace Catch {
public: // IStreamingReporter public: // IStreamingReporter
virtual ReporterPreferences getPreferences() const override; ReporterPreferences getPreferences() const override;
virtual void noMatchingTestCases( std::string const& spec ) override; void noMatchingTestCases( std::string const& spec ) override;
static std::set<Verbosity> getSupportedVerbosities(); static std::set<Verbosity> getSupportedVerbosities();
virtual void testRunStarting( TestRunInfo const& testRunInfo ) override; void testRunStarting( TestRunInfo const& testRunInfo ) override;
void testGroupStarting( GroupInfo const& groupInfo ) override;
virtual void testGroupStarting( GroupInfo const& groupInfo ) override; void testCaseStarting( TestCaseInfo const& testInfo ) override;
void sectionStarting( SectionInfo const& sectionInfo ) override;
void assertionStarting( AssertionInfo const& assertionInfo ) override;
virtual void testCaseStarting( TestCaseInfo const& testInfo ) override;
virtual void sectionStarting( SectionInfo const& sectionInfo ) override;
virtual void assertionStarting( AssertionInfo const& assertionInfo ) override;
// The return value indicates if the messages buffer should be cleared: // The return value indicates if the messages buffer should be cleared:
virtual bool assertionEnded( AssertionStats const& assertionStats ) override; bool assertionEnded( AssertionStats const& assertionStats ) override;
void sectionEnded( SectionStats const& sectionStats ) override;
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
void testGroupEnded( TestGroupStats const& testGroupStats ) override;
void testRunEnded( TestRunStats const& testRunStats ) override;
virtual void sectionEnded( SectionStats const& sectionStats ) override; void skipTest( TestCaseInfo const& testInfo ) override;
bool isMulti() const override;
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override;
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override;
virtual void testRunEnded( TestRunStats const& testRunStats ) override;
virtual void skipTest( TestCaseInfo const& testInfo ) override;
virtual bool isMulti() const override;
}; };

View File

@ -23,25 +23,25 @@ namespace Catch {
using StreamingReporterBase::StreamingReporterBase; using StreamingReporterBase::StreamingReporterBase;
virtual ~TAPReporter(); ~TAPReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in TAP format, suitable for test harneses"; return "Reports test results in TAP format, suitable for test harneses";
} }
virtual ReporterPreferences getPreferences() const { ReporterPreferences getPreferences() const override {
ReporterPreferences prefs; ReporterPreferences prefs;
prefs.shouldRedirectStdOut = false; prefs.shouldRedirectStdOut = false;
return prefs; return prefs;
} }
virtual void noMatchingTestCases( std::string const& spec ) { void noMatchingTestCases( std::string const& spec ) override {
stream << "# No test cases matched '" << spec << "'" << std::endl; stream << "# No test cases matched '" << spec << "'" << std::endl;
} }
virtual void assertionStarting( AssertionInfo const& ) {} void assertionStarting( AssertionInfo const& ) override {}
virtual bool assertionEnded( AssertionStats const& _assertionStats ) { bool assertionEnded( AssertionStats const& _assertionStats ) override {
++counter; ++counter;
AssertionPrinter printer( stream, _assertionStats, counter ); AssertionPrinter printer( stream, _assertionStats, counter );
@ -52,7 +52,7 @@ namespace Catch {
return true; return true;
} }
virtual void testRunEnded( TestRunStats const& _testRunStats ) { void testRunEnded( TestRunStats const& _testRunStats ) override {
printTotals( _testRunStats.totals ); printTotals( _testRunStats.totals );
stream << "\n" << std::endl; stream << "\n" << std::endl;
StreamingReporterBase::testRunEnded( _testRunStats ); StreamingReporterBase::testRunEnded( _testRunStats );
@ -66,7 +66,6 @@ namespace Catch {
AssertionPrinter( AssertionPrinter const& ) = delete; AssertionPrinter( AssertionPrinter const& ) = delete;
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t counter ) AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t counter )
: stream( _stream ) : stream( _stream )
, stats( _stats )
, result( _stats.assertionResult ) , result( _stats.assertionResult )
, messages( _stats.infoMessages ) , messages( _stats.infoMessages )
, itMessage( _stats.infoMessages.begin() ) , itMessage( _stats.infoMessages.begin() )
@ -229,7 +228,6 @@ namespace Catch {
private: private:
std::ostream& stream; std::ostream& stream;
AssertionStats const& stats;
AssertionResult const& result; AssertionResult const& result;
std::vector<MessageInfo> messages; std::vector<MessageInfo> messages;
std::vector<MessageInfo>::const_iterator itMessage; std::vector<MessageInfo>::const_iterator itMessage;

View File

@ -42,33 +42,32 @@ namespace Catch {
replaceInPlace( escaped, "]", "|]" ); replaceInPlace( escaped, "]", "|]" );
return escaped; return escaped;
} }
virtual ~TeamCityReporter() override; ~TeamCityReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as TeamCity service messages"; return "Reports test results as TeamCity service messages";
} }
virtual void skipTest( TestCaseInfo const& /* testInfo */ ) override { void skipTest( TestCaseInfo const& /* testInfo */ ) override {
} }
virtual void noMatchingTestCases( std::string const& /* spec */ ) override {} void noMatchingTestCases( std::string const& /* spec */ ) override {}
virtual void testGroupStarting( GroupInfo const& groupInfo ) override { void testGroupStarting( GroupInfo const& groupInfo ) override {
StreamingReporterBase::testGroupStarting( groupInfo ); StreamingReporterBase::testGroupStarting( groupInfo );
stream << "##teamcity[testSuiteStarted name='" stream << "##teamcity[testSuiteStarted name='"
<< escape( groupInfo.name ) << "']\n"; << escape( groupInfo.name ) << "']\n";
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { void testGroupEnded( TestGroupStats const& testGroupStats ) override {
StreamingReporterBase::testGroupEnded( testGroupStats ); StreamingReporterBase::testGroupEnded( testGroupStats );
stream << "##teamcity[testSuiteFinished name='" stream << "##teamcity[testSuiteFinished name='"
<< escape( testGroupStats.groupInfo.name ) << "']\n"; << escape( testGroupStats.groupInfo.name ) << "']\n";
} }
virtual void assertionStarting( AssertionInfo const& ) override { void assertionStarting( AssertionInfo const& ) override {}
}
virtual bool assertionEnded( AssertionStats const& assertionStats ) override { bool assertionEnded( AssertionStats const& assertionStats ) override {
AssertionResult const& result = assertionStats.assertionResult; AssertionResult const& result = assertionStats.assertionResult;
if( !result.isOk() ) { if( !result.isOk() ) {
@ -139,19 +138,19 @@ namespace Catch {
return true; return true;
} }
virtual void sectionStarting( SectionInfo const& sectionInfo ) override { void sectionStarting( SectionInfo const& sectionInfo ) override {
m_headerPrintedForThisSection = false; m_headerPrintedForThisSection = false;
StreamingReporterBase::sectionStarting( sectionInfo ); StreamingReporterBase::sectionStarting( sectionInfo );
} }
virtual void testCaseStarting( TestCaseInfo const& testInfo ) override { void testCaseStarting( TestCaseInfo const& testInfo ) override {
m_testTimer.start(); m_testTimer.start();
StreamingReporterBase::testCaseStarting( testInfo ); StreamingReporterBase::testCaseStarting( testInfo );
stream << "##teamcity[testStarted name='" stream << "##teamcity[testStarted name='"
<< escape( testInfo.name ) << "']\n"; << escape( testInfo.name ) << "']\n";
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { void testCaseEnded( TestCaseStats const& testCaseStats ) override {
StreamingReporterBase::testCaseEnded( testCaseStats ); StreamingReporterBase::testCaseEnded( testCaseStats );
if( !testCaseStats.stdOut.empty() ) if( !testCaseStats.stdOut.empty() )
stream << "##teamcity[testStdOut name='" stream << "##teamcity[testStdOut name='"

View File

@ -23,7 +23,7 @@ namespace Catch {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }
virtual ~XmlReporter() override; ~XmlReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as an XML document"; return "Reports test results as an XML document";
@ -41,11 +41,11 @@ namespace Catch {
public: // StreamingReporterBase public: // StreamingReporterBase
virtual void noMatchingTestCases( std::string const& s ) override { void noMatchingTestCases( std::string const& s ) override {
StreamingReporterBase::noMatchingTestCases( s ); StreamingReporterBase::noMatchingTestCases( s );
} }
virtual void testRunStarting( TestRunInfo const& testInfo ) override { void testRunStarting( TestRunInfo const& testInfo ) override {
StreamingReporterBase::testRunStarting( testInfo ); StreamingReporterBase::testRunStarting( testInfo );
std::string stylesheetRef = getStylesheetRef(); std::string stylesheetRef = getStylesheetRef();
if( !stylesheetRef.empty() ) if( !stylesheetRef.empty() )
@ -55,13 +55,13 @@ namespace Catch {
m_xml.writeAttribute( "name", m_config->name() ); m_xml.writeAttribute( "name", m_config->name() );
} }
virtual void testGroupStarting( GroupInfo const& groupInfo ) override { void testGroupStarting( GroupInfo const& groupInfo ) override {
StreamingReporterBase::testGroupStarting( groupInfo ); StreamingReporterBase::testGroupStarting( groupInfo );
m_xml.startElement( "Group" ) m_xml.startElement( "Group" )
.writeAttribute( "name", groupInfo.name ); .writeAttribute( "name", groupInfo.name );
} }
virtual void testCaseStarting( TestCaseInfo const& testInfo ) override { void testCaseStarting( TestCaseInfo const& testInfo ) override {
StreamingReporterBase::testCaseStarting(testInfo); StreamingReporterBase::testCaseStarting(testInfo);
m_xml.startElement( "TestCase" ) m_xml.startElement( "TestCase" )
.writeAttribute( "name", trim( testInfo.name ) ) .writeAttribute( "name", trim( testInfo.name ) )
@ -75,7 +75,7 @@ namespace Catch {
m_xml.ensureTagClosed(); m_xml.ensureTagClosed();
} }
virtual void sectionStarting( SectionInfo const& sectionInfo ) override { void sectionStarting( SectionInfo const& sectionInfo ) override {
StreamingReporterBase::sectionStarting( sectionInfo ); StreamingReporterBase::sectionStarting( sectionInfo );
if( m_sectionDepth++ > 0 ) { if( m_sectionDepth++ > 0 ) {
m_xml.startElement( "Section" ) m_xml.startElement( "Section" )
@ -86,9 +86,9 @@ namespace Catch {
} }
} }
virtual void assertionStarting( AssertionInfo const& ) override { } void assertionStarting( AssertionInfo const& ) override { }
virtual bool assertionEnded( AssertionStats const& assertionStats ) override { bool assertionEnded( AssertionStats const& assertionStats ) override {
AssertionResult const& result = assertionStats.assertionResult; AssertionResult const& result = assertionStats.assertionResult;
@ -163,7 +163,7 @@ namespace Catch {
return true; return true;
} }
virtual void sectionEnded( SectionStats const& sectionStats ) override { void sectionEnded( SectionStats const& sectionStats ) override {
StreamingReporterBase::sectionEnded( sectionStats ); StreamingReporterBase::sectionEnded( sectionStats );
if( --m_sectionDepth > 0 ) { if( --m_sectionDepth > 0 ) {
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
@ -178,7 +178,7 @@ namespace Catch {
} }
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { void testCaseEnded( TestCaseStats const& testCaseStats ) override {
StreamingReporterBase::testCaseEnded( testCaseStats ); StreamingReporterBase::testCaseEnded( testCaseStats );
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
@ -194,7 +194,7 @@ namespace Catch {
m_xml.endElement(); m_xml.endElement();
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { void testGroupEnded( TestGroupStats const& testGroupStats ) override {
StreamingReporterBase::testGroupEnded( testGroupStats ); StreamingReporterBase::testGroupEnded( testGroupStats );
// TODO: Check testGroupStats.aborting and act accordingly. // TODO: Check testGroupStats.aborting and act accordingly.
m_xml.scopedElement( "OverallResults" ) m_xml.scopedElement( "OverallResults" )
@ -204,7 +204,7 @@ namespace Catch {
m_xml.endElement(); m_xml.endElement();
} }
virtual void testRunEnded( TestRunStats const& testRunStats ) override { void testRunEnded( TestRunStats const& testRunStats ) override {
StreamingReporterBase::testRunEnded( testRunStats ); StreamingReporterBase::testRunEnded( testRunStats );
m_xml.scopedElement( "OverallResults" ) m_xml.scopedElement( "OverallResults" )
.writeAttribute( "successes", testRunStats.totals.assertions.passed ) .writeAttribute( "successes", testRunStats.totals.assertions.passed )

View File

@ -192,11 +192,11 @@ class ExceptionMatcher : public Catch::MatcherBase<SpecialException> {
int m_expected; int m_expected;
public: public:
ExceptionMatcher(int i):m_expected(i) {} ExceptionMatcher(int i):m_expected(i) {}
virtual bool match(SpecialException const& se) const override { bool match(SpecialException const& se) const override {
return se.i == m_expected; return se.i == m_expected;
} }
virtual std::string describe() const override { std::string describe() const override {
std::ostringstream ss; std::ostringstream ss;
ss << "special exception has value of " << m_expected; ss << "special exception has value of " << m_expected;
return ss.str(); return ss.str();