Moved "no test cases matched" message to reporter

This commit is contained in:
Phil Nash 2013-03-12 19:06:40 +00:00
parent 6d56d71318
commit 7542685a2f
4 changed files with 11 additions and 1 deletions

View File

@ -70,7 +70,7 @@ namespace Catch {
} }
} }
if( testsRunForGroup == 0 && !filterGroup.getName().empty() ) if( testsRunForGroup == 0 && !filterGroup.getName().empty() )
std::cerr << "\n[No test cases matched with: " << filterGroup.getName() << "]" << std::endl; m_reporter->noMatchingTestCases( filterGroup.getName() );
return totals; return totals;
} }

View File

@ -197,6 +197,8 @@ namespace Catch
// static std::string getDescription(); // static std::string getDescription();
virtual ReporterPreferences getPreferences() const = 0; virtual ReporterPreferences getPreferences() const = 0;
virtual void noMatchingTestCases( std::string const& spec ) = 0;
virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
@ -221,6 +223,8 @@ namespace Catch
{} {}
virtual ~StreamingReporterBase(); virtual ~StreamingReporterBase();
virtual void noMatchingTestCases( std::string const& ) {}
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) { virtual void testRunStarting( TestRunInfo const& _testRunInfo ) {
testRunInfo = _testRunInfo; testRunInfo = _testRunInfo;
@ -390,6 +394,7 @@ namespace Catch
return prefs; return prefs;
} }
virtual void noMatchingTestCases( std::string const& ) {}
virtual void testRunStarting( TestRunInfo const& ) { virtual void testRunStarting( TestRunInfo const& ) {
m_legacyReporter->StartTesting(); m_legacyReporter->StartTesting();
} }

View File

@ -31,6 +31,10 @@ namespace Catch {
return prefs; return prefs;
} }
virtual void noMatchingTestCases( std::string const& spec ) {
stream << "No test cases matched '" << spec << "'" << std::endl;
}
virtual void assertionStarting( AssertionInfo const& ) { virtual void assertionStarting( AssertionInfo const& ) {
} }

View File

@ -35,6 +35,7 @@ namespace Catch {
return ReporterPreferences(); return ReporterPreferences();
} }
virtual void noMatchingTestCases( std::string const& ) {}
virtual void testRunStarting( TestRunInfo const& ) {} virtual void testRunStarting( TestRunInfo const& ) {}
virtual void testGroupStarting( GroupInfo const& ) {} virtual void testGroupStarting( GroupInfo const& ) {}
virtual void testCaseStarting( TestCaseInfo const& ) {} virtual void testCaseStarting( TestCaseInfo const& ) {}