From d96f6fca9ac0e86e079a40ed15fd28dceefd19cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 16 Jun 2019 19:27:06 +0200 Subject: [PATCH] Remove --list-test-names-only People should use verbosity modifiers with `--list-tests` instead. Closes #1190 --- docs/deprecations.md | 12 ------------ docs/release-notes.md | 5 ++++- include/internal/catch_commandline.cpp | 3 --- include/internal/catch_config.cpp | 1 - include/internal/catch_config.hpp | 2 -- include/internal/catch_list.cpp | 20 -------------------- projects/CMakeLists.txt | 6 ------ 7 files changed, 4 insertions(+), 45 deletions(-) diff --git a/docs/deprecations.md b/docs/deprecations.md index bf7a71fabb..42f7a073c3 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -11,18 +11,6 @@ at least the next major release. ## 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 Currently, the tags part of `TEST_CASE` (and others) macro can also diff --git a/docs/release-notes.md b/docs/release-notes.md index 0595961759..cb389512b6 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -32,8 +32,11 @@ ## 3.0.0 (in progress) -### Breaking changes +### (Potentially) Breaking changes * `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 * The `INFO` macro no longer contains superfluous semicolon (#1456) diff --git a/include/internal/catch_commandline.cpp b/include/internal/catch_commandline.cpp index 365a3c9d6c..0008c577a7 100644 --- a/include/internal/catch_commandline.cpp +++ b/include/internal/catch_commandline.cpp @@ -181,9 +181,6 @@ namespace Catch { | Opt( setVerbosity, "quiet|normal|high" ) ["-v"]["--verbosity"] ( "set output verbosity" ) - | Opt( config.listTestNamesOnly ) - ["--list-test-names-only"] - ( "list all/matching test cases names only" ) | Opt( config.listReporters ) ["--list-reporters"] ( "list all reporters" ) diff --git a/include/internal/catch_config.cpp b/include/internal/catch_config.cpp index e222328b97..6a5e5f38db 100644 --- a/include/internal/catch_config.cpp +++ b/include/internal/catch_config.cpp @@ -41,7 +41,6 @@ namespace Catch { } 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::listReporters() const { return m_data.listReporters; } diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 95b67d25fc..2074d933e7 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -30,7 +30,6 @@ namespace Catch { bool listTests = false; bool listTags = false; bool listReporters = false; - bool listTestNamesOnly = false; bool showSuccessfulTests = false; bool shouldDebugBreak = false; @@ -79,7 +78,6 @@ namespace Catch { std::string const& getFilename() const; bool listTests() const; - bool listTestNamesOnly() const; bool listTags() const; bool listReporters() const; diff --git a/include/internal/catch_list.cpp b/include/internal/catch_list.cpp index f8b3503f7d..7a1ae7d9ed 100644 --- a/include/internal/catch_list.cpp +++ b/include/internal/catch_list.cpp @@ -71,22 +71,6 @@ namespace Catch { 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 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) { TestSpec testSpec = config.testSpec(); if (config.hasTestFilters()) @@ -172,10 +156,6 @@ namespace Catch { listed = true; listTests(*config); } - if (config->listTestNamesOnly()) { - listed = true; - listTestsNamesOnly(*config); - } if (config->listTags()) { listed = true; listTags(*config); diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt index e0e7b63ed7..d3556ceec8 100644 --- a/projects/CMakeLists.txt +++ b/projects/CMakeLists.txt @@ -396,12 +396,6 @@ add_test(NAME List::Reporters::Output COMMAND $ --list-rep set_tests_properties(List::Reporters::Output PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:") add_test(NAME List::Reporters::ExitCode COMMAND $ --list-reporters) -add_test(NAME List::Tests::NamesOnly::Output COMMAND $ --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 $ --list-test-names-only) - add_test(NAME NoAssertions COMMAND $ -w NoAssertions)