Fixes #1766: Catch terminates when parsing invalid test name

This commit is contained in:
amitherman95
2019-10-19 16:50:46 +03:00
committed by Jozef Grajciar
parent 01ef7076f5
commit 84856844e1
12 changed files with 88 additions and 28 deletions

View File

@@ -51,6 +51,8 @@ namespace Catch {
void noMatchingTestCases(std::string const&) override {}
void reportInvalidArguments(std::string const&) override {}
void testRunStarting(TestRunInfo const& _testRunInfo) override {
currentTestRunInfo = _testRunInfo;
}
@@ -277,4 +279,4 @@ namespace Catch {
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
#endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED

View File

@@ -383,6 +383,10 @@ void ConsoleReporter::noMatchingTestCases(std::string const& spec) {
stream << "No test cases matched '" << spec << '\'' << std::endl;
}
void ConsoleReporter::reportInvalidArguments(std::string const&arg){
stream << "Invalid Filter: " << arg << std::endl;
}
void ConsoleReporter::assertionStarting(AssertionInfo const&) {}
bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {
@@ -694,4 +698,4 @@ CATCH_REGISTER_REPORTER("console", ConsoleReporter)
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
#endif

View File

@@ -32,6 +32,8 @@ namespace Catch {
void noMatchingTestCases(std::string const& spec) override;
void reportInvalidArguments(std::string const&arg) override;
void assertionStarting(AssertionInfo const&) override;
bool assertionEnded(AssertionStats const& _assertionStats) override;
@@ -84,4 +86,4 @@ namespace Catch {
#pragma warning(pop)
#endif
#endif // TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED
#endif // TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED

View File

@@ -41,6 +41,13 @@ namespace Catch {
}
m_reporter->noMatchingTestCases( spec );
}
void ListeningReporter::reportInvalidArguments(std::string const&arg){
for ( auto const& listener : m_listeners ) {
listener->reportInvalidArguments( arg );
}
m_reporter->reportInvalidArguments( arg );
}
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
void ListeningReporter::benchmarkPreparing( std::string const& name ) {
@@ -154,4 +161,4 @@ namespace Catch {
return true;
}
} // end namespace Catch
} // end namespace Catch

View File

@@ -28,7 +28,9 @@ 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)
@@ -58,4 +60,4 @@ namespace Catch {
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
#endif // TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED