Remove --list-test-names-only

People should use verbosity modifiers with `--list-tests` instead.

Closes #1190
This commit is contained in:
Martin Hořeňovský 2019-06-16 19:27:06 +02:00
parent d2cddfc9c5
commit c582e351ce
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
7 changed files with 4 additions and 45 deletions

View File

@ -11,18 +11,6 @@ at least the next major release.
## Deprecations ## Deprecations
### `--list-*` return values
The return codes of the `--list-*` family of command line arguments
will no longer be equal to the number of tests/tags/etc found, instead
it will be 0 for success and non-zero for failure.
### `--list-test-names-only`
`--list-test-names-only` command line argument will be removed.
### Secondary description amongst tags ### Secondary description amongst tags
Currently, the tags part of `TEST_CASE` (and others) macro can also Currently, the tags part of `TEST_CASE` (and others) macro can also

View File

@ -32,8 +32,11 @@
## 3.0.0 (in progress) ## 3.0.0 (in progress)
### Breaking changes ### (Potentially) Breaking changes
* `ANON_TEST_CASE` has been removed, use `TEST_CASE` with no arguments instead (#1220) * `ANON_TEST_CASE` has been removed, use `TEST_CASE` with no arguments instead (#1220)
* `--list*` commands no longer have non-zero return code (#1410)
* `--list-test-names-only` has been removed (#1190)
* You should use verbosity-modifiers for `--list-tests` instead
### Fixes ### Fixes
* The `INFO` macro no longer contains superfluous semicolon (#1456) * The `INFO` macro no longer contains superfluous semicolon (#1456)

View File

@ -181,9 +181,6 @@ namespace Catch {
| Opt( setVerbosity, "quiet|normal|high" ) | Opt( setVerbosity, "quiet|normal|high" )
["-v"]["--verbosity"] ["-v"]["--verbosity"]
( "set output verbosity" ) ( "set output verbosity" )
| Opt( config.listTestNamesOnly )
["--list-test-names-only"]
( "list all/matching test cases names only" )
| Opt( config.listReporters ) | Opt( config.listReporters )
["--list-reporters"] ["--list-reporters"]
( "list all reporters" ) ( "list all reporters" )

View File

@ -41,7 +41,6 @@ namespace Catch {
} }
bool Config::listTests() const { return m_data.listTests; } bool Config::listTests() const { return m_data.listTests; }
bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; }
bool Config::listTags() const { return m_data.listTags; } bool Config::listTags() const { return m_data.listTags; }
bool Config::listReporters() const { return m_data.listReporters; } bool Config::listReporters() const { return m_data.listReporters; }

View File

@ -30,7 +30,6 @@ namespace Catch {
bool listTests = false; bool listTests = false;
bool listTags = false; bool listTags = false;
bool listReporters = false; bool listReporters = false;
bool listTestNamesOnly = false;
bool showSuccessfulTests = false; bool showSuccessfulTests = false;
bool shouldDebugBreak = false; bool shouldDebugBreak = false;
@ -79,7 +78,6 @@ namespace Catch {
std::string const& getFilename() const; std::string const& getFilename() const;
bool listTests() const; bool listTests() const;
bool listTestNamesOnly() const;
bool listTags() const; bool listTags() const;
bool listReporters() const; bool listReporters() const;

View File

@ -71,22 +71,6 @@ namespace Catch {
Catch::cout() << pluralise(matchedTestCases.size(), "matching test case") << '\n' << std::endl; Catch::cout() << pluralise(matchedTestCases.size(), "matching test case") << '\n' << std::endl;
} }
void listTestsNamesOnly(Config const& config) {
TestSpec testSpec = config.testSpec();
std::size_t matchedTests = 0;
std::vector<TestCase> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
for (auto const& testCaseInfo : matchedTestCases) {
matchedTests++;
if (startsWith(testCaseInfo.name, '#'))
Catch::cout() << '"' << testCaseInfo.name << '"';
else
Catch::cout() << testCaseInfo.name;
if (config.verbosity() >= Verbosity::High)
Catch::cout() << "\t@" << testCaseInfo.lineInfo;
Catch::cout() << std::endl;
}
}
void listTags(Config const& config) { void listTags(Config const& config) {
TestSpec testSpec = config.testSpec(); TestSpec testSpec = config.testSpec();
if (config.hasTestFilters()) if (config.hasTestFilters())
@ -172,10 +156,6 @@ namespace Catch {
listed = true; listed = true;
listTests(*config); listTests(*config);
} }
if (config->listTestNamesOnly()) {
listed = true;
listTestsNamesOnly(*config);
}
if (config->listTags()) { if (config->listTags()) {
listed = true; listed = true;
listTags(*config); listTags(*config);

View File

@ -396,12 +396,6 @@ add_test(NAME List::Reporters::Output COMMAND $<TARGET_FILE:SelfTest> --list-rep
set_tests_properties(List::Reporters::Output PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:") set_tests_properties(List::Reporters::Output PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:")
add_test(NAME List::Reporters::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-reporters) add_test(NAME List::Reporters::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
add_test(NAME List::Tests::NamesOnly::Output COMMAND $<TARGET_FILE:SelfTest> --list-test-names-only)
set_tests_properties(List::Tests::NamesOnly::Output PROPERTIES
PASS_REGULAR_EXPRESSION "Regex string matcher"
FAIL_REGULAR_EXPRESSION "Hidden Test")
add_test(NAME List::Tests::NamesOnly::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-test-names-only)
add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions) add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions)