Rename reportInvalidArguments -> reportInvalidTestSpec

This is has been what it actually does for a long time, but it
has not been renamed earlier due to API compatibility.
This commit is contained in:
Martin Hořeňovský 2021-12-12 21:54:00 +01:00
parent 08939cc8bb
commit 602e484f02
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
14 changed files with 22 additions and 22 deletions

View File

@ -153,14 +153,14 @@ void listTags( std::vector<TagInfo> const& tagInfos );
## Miscellaneous events ## Miscellaneous events
```cpp ```cpp
void reportInvalidArguments( StringRef unmatchedSpec ); void reportInvalidTestSpec( StringRef unmatchedSpec );
void fatalErrorEncountered( StringRef error ); void fatalErrorEncountered( StringRef error );
void noMatchingTestCases( StringRef unmatchedSpec ); void noMatchingTestCases( StringRef unmatchedSpec );
``` ```
These are one-off events that do not neatly fit into other categories. These are one-off events that do not neatly fit into other categories.
`reportInvalidArguments` is sent for each [test specification command line `reportInvalidTestSpec` is sent for each [test specification command line
argument](command-line.md#specifying-which-tests-to-run) that wasn't argument](command-line.md#specifying-which-tests-to-run) that wasn't
parsed into a valid spec. parsed into a valid spec.

View File

@ -62,7 +62,7 @@ namespace Catch {
m_config{config}, m_config{config},
m_context{config, CATCH_MOVE(reporter)} { m_context{config, CATCH_MOVE(reporter)} {
assert( m_config->testSpec().getInvalidArgs().empty() && assert( m_config->testSpec().getInvalidSpecs().empty() &&
"Invalid test specs should be handled before running tests" ); "Invalid test specs should be handled before running tests" );
auto const& allTestCases = getAllTestCasesSorted(*m_config); auto const& allTestCases = getAllTestCasesSorted(*m_config);
@ -286,10 +286,10 @@ namespace Catch {
// Create reporter(s) so we can route listings through them // Create reporter(s) so we can route listings through them
auto reporter = makeReporter(m_config.get()); auto reporter = makeReporter(m_config.get());
auto const& invalidSpecs = m_config->testSpec().getInvalidArgs(); auto const& invalidSpecs = m_config->testSpec().getInvalidSpecs();
if ( !invalidSpecs.empty() ) { if ( !invalidSpecs.empty() ) {
for ( auto const& spec : invalidSpecs ) { for ( auto const& spec : invalidSpecs ) {
reporter->reportInvalidArguments( spec ); reporter->reportInvalidTestSpec( spec );
} }
return 1; return 1;
} }

View File

@ -98,8 +98,8 @@ namespace Catch {
return matches; return matches;
} }
const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ const TestSpec::vectorStrings& TestSpec::getInvalidSpecs() const {
return (m_invalidArgs); return m_invalidSpecs;
} }
} }

View File

@ -72,11 +72,11 @@ namespace Catch {
bool hasFilters() const; bool hasFilters() const;
bool matches( TestCaseInfo const& testCase ) const; bool matches( TestCaseInfo const& testCase ) const;
Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const; Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const;
const vectorStrings & getInvalidArgs() const; const vectorStrings & getInvalidSpecs() const;
private: private:
std::vector<Filter> m_filters; std::vector<Filter> m_filters;
std::vector<std::string> m_invalidArgs; std::vector<std::string> m_invalidSpecs;
friend class TestSpecParser; friend class TestSpecParser;
}; };
} }

View File

@ -173,8 +173,8 @@ namespace Catch {
//! Called when no test cases match provided test spec //! Called when no test cases match provided test spec
virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0; virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0;
//! Called for all invalid arguments from the cli //! Called for all invalid test specs from the cli
virtual void reportInvalidArguments( StringRef invalidArgument ) = 0; virtual void reportInvalidTestSpec( StringRef invalidArgument ) = 0;
/** /**
* Called once in a testing run before tests are started * Called once in a testing run before tests are started

View File

@ -28,7 +28,7 @@ namespace Catch {
for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
//if visitChar fails //if visitChar fails
if( !visitChar( m_arg[m_pos] ) ){ if( !visitChar( m_arg[m_pos] ) ){
m_testSpec.m_invalidArgs.push_back(arg); m_testSpec.m_invalidSpecs.push_back(arg);
break; break;
} }
endMode(); endMode();

View File

@ -236,7 +236,7 @@ namespace Catch {
void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {} void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {}
void EventListenerBase::listTags( std::vector<TagInfo> const& ) {} void EventListenerBase::listTags( std::vector<TagInfo> const& ) {}
void EventListenerBase::noMatchingTestCases( StringRef ) {} void EventListenerBase::noMatchingTestCases( StringRef ) {}
void EventListenerBase::reportInvalidArguments( StringRef ) {} void EventListenerBase::reportInvalidTestSpec( StringRef ) {}
void EventListenerBase::testRunStarting( TestRunInfo const& ) {} void EventListenerBase::testRunStarting( TestRunInfo const& ) {}
void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {}
void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {} void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {}

View File

@ -386,7 +386,7 @@ void ConsoleReporter::noMatchingTestCases( StringRef unmatchedSpec ) {
m_stream << "No test cases matched '" << unmatchedSpec << "'\n"; m_stream << "No test cases matched '" << unmatchedSpec << "'\n";
} }
void ConsoleReporter::reportInvalidArguments( StringRef arg ) { void ConsoleReporter::reportInvalidTestSpec( StringRef arg ) {
m_stream << "Invalid Filter: " << arg << '\n'; m_stream << "Invalid Filter: " << arg << '\n';
} }

View File

@ -24,7 +24,7 @@ namespace Catch {
static std::string getDescription(); static std::string getDescription();
void noMatchingTestCases( StringRef unmatchedSpec ) override; void noMatchingTestCases( StringRef unmatchedSpec ) override;
void reportInvalidArguments( StringRef arg ) override; void reportInvalidTestSpec( StringRef arg ) override;
void assertionStarting(AssertionInfo const&) override; void assertionStarting(AssertionInfo const&) override;

View File

@ -100,7 +100,7 @@ namespace Catch {
void benchmarkFailed( StringRef ) override {} void benchmarkFailed( StringRef ) override {}
void noMatchingTestCases( StringRef ) override {} void noMatchingTestCases( StringRef ) override {}
void reportInvalidArguments( StringRef ) override {} void reportInvalidTestSpec( StringRef ) override {}
void fatalErrorEncountered( StringRef /*error*/ ) override {} void fatalErrorEncountered( StringRef /*error*/ ) override {}
void testRunStarting( TestRunInfo const& ) override {} void testRunStarting( TestRunInfo const& ) override {}

View File

@ -24,7 +24,7 @@ namespace Catch {
EventListenerBase( ReporterConfig const& config ): EventListenerBase( ReporterConfig const& config ):
IStreamingReporter( config.fullConfig() ) {} IStreamingReporter( config.fullConfig() ) {}
void reportInvalidArguments( StringRef unmatchedSpec ) override; void reportInvalidTestSpec( StringRef unmatchedSpec ) override;
void fatalErrorEncountered( StringRef error ) override; void fatalErrorEncountered( StringRef error ) override;
void benchmarkPreparing( StringRef name ) override; void benchmarkPreparing( StringRef name ) override;

View File

@ -36,11 +36,11 @@ namespace Catch {
m_reporter->fatalErrorEncountered( error ); m_reporter->fatalErrorEncountered( error );
} }
void ListeningReporter::reportInvalidArguments( StringRef arg ) { void ListeningReporter::reportInvalidTestSpec( StringRef arg ) {
for ( auto& listener : m_listeners ) { for ( auto& listener : m_listeners ) {
listener->reportInvalidArguments( arg ); listener->reportInvalidTestSpec( arg );
} }
m_reporter->reportInvalidArguments( arg ); m_reporter->reportInvalidTestSpec( arg );
} }
void ListeningReporter::benchmarkPreparing( StringRef name ) { void ListeningReporter::benchmarkPreparing( StringRef name ) {

View File

@ -32,7 +32,7 @@ namespace Catch {
void noMatchingTestCases( StringRef unmatchedSpec ) override; void noMatchingTestCases( StringRef unmatchedSpec ) override;
void fatalErrorEncountered( StringRef error ) override; void fatalErrorEncountered( StringRef error ) override;
void reportInvalidArguments( StringRef arg ) override; void reportInvalidTestSpec( StringRef arg ) override;
void benchmarkPreparing( StringRef name ) override; void benchmarkPreparing( StringRef name ) override;
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;

View File

@ -32,7 +32,7 @@ namespace Catch {
void fatalErrorEncountered( StringRef /*error*/ ) override {} void fatalErrorEncountered( StringRef /*error*/ ) override {}
void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {} void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}
void reportInvalidArguments( StringRef /*invalidArgument*/ ) override {} void reportInvalidTestSpec( StringRef /*invalidArgument*/ ) override {}
void testRunStarting( TestRunInfo const& _testRunInfo ) override; void testRunStarting( TestRunInfo const& _testRunInfo ) override;