diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp index 948869e7..1fd6b6d1 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -127,14 +127,14 @@ namespace Catch { void IStreamingReporter::fatalErrorEncountered( StringRef ) {} - void IStreamingReporter::listReporters(std::vector const& descriptions, IConfig const& config) { + void IStreamingReporter::listReporters(std::vector const& descriptions) { Catch::cout() << "Available reporters:\n"; const auto maxNameLen = std::max_element(descriptions.begin(), descriptions.end(), [](ReporterDescription const& lhs, ReporterDescription const& rhs) { return lhs.name.size() < rhs.name.size(); }) ->name.size(); for (auto const& desc : descriptions) { - if (config.verbosity() == Verbosity::Quiet) { + if (m_config->verbosity() == Verbosity::Quiet) { Catch::cout() << TextFlow::Column(desc.name) .indent(2) @@ -154,16 +154,16 @@ namespace Catch { Catch::cout() << std::endl; } - void IStreamingReporter::listTests(std::vector const& tests, IConfig const& config) { + void IStreamingReporter::listTests(std::vector const& tests) { // We special case this to provide the equivalent of old // `--list-test-names-only`, which could then be used by the // `--input-file` option. - if (config.verbosity() == Verbosity::Quiet) { + if (m_config->verbosity() == Verbosity::Quiet) { listTestNamesOnly(tests); return; } - if (config.hasTestFilters()) { + if (m_config->hasTestFilters()) { Catch::cout() << "Matching test cases:\n"; } else { Catch::cout() << "All available test cases:\n"; @@ -177,23 +177,24 @@ namespace Catch { Colour colourGuard(colour); Catch::cout() << TextFlow::Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; - if (config.verbosity() >= Verbosity::High) { + if (m_config->verbosity() >= Verbosity::High) { Catch::cout() << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; } - if (!testCaseInfo.tags.empty() && config.verbosity() > Verbosity::Quiet) { + if ( !testCaseInfo.tags.empty() && + m_config->verbosity() > Verbosity::Quiet ) { Catch::cout() << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; } } - if (!config.hasTestFilters()) { + if (!m_config->hasTestFilters()) { Catch::cout() << pluralise(tests.size(), "test case") << '\n' << std::endl; } else { Catch::cout() << pluralise(tests.size(), "matching test case") << '\n' << std::endl; } } - void IStreamingReporter::listTags(std::vector const& tags, IConfig const& config) { - if (config.hasTestFilters()) { + void IStreamingReporter::listTags(std::vector const& tags) { + if (m_config->hasTestFilters()) { Catch::cout() << "Tags for matching test cases:\n"; } else { Catch::cout() << "All available tags:\n"; diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index 9dbd1847..5449cc22 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -222,11 +222,11 @@ namespace Catch { virtual void fatalErrorEncountered( StringRef name ); //! Writes out information about provided reporters using reporter-specific format - virtual void listReporters(std::vector const& descriptions, IConfig const& config); + virtual void listReporters(std::vector const& descriptions); //! Writes out information about provided tests using reporter-specific format - virtual void listTests(std::vector const& tests, IConfig const& config); + virtual void listTests(std::vector const& tests); //! Writes out information about the provided tags using reporter-specific format - virtual void listTags(std::vector const& tags, IConfig const& config); + virtual void listTags(std::vector const& tags); }; using IStreamingReporterPtr = Detail::unique_ptr; diff --git a/src/catch2/internal/catch_list.cpp b/src/catch2/internal/catch_list.cpp index 1cedb3ae..d7969096 100644 --- a/src/catch2/internal/catch_list.cpp +++ b/src/catch2/internal/catch_list.cpp @@ -24,7 +24,7 @@ namespace Catch { void listTests(IStreamingReporter& reporter, IConfig const& config) { auto const& testSpec = config.testSpec(); auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); - reporter.listTests(matchedTestCases, config); + reporter.listTests(matchedTestCases); } void listTags(IStreamingReporter& reporter, IConfig const& config) { @@ -46,10 +46,10 @@ namespace Catch { infos.push_back(std::move(tagc.second)); } - reporter.listTags(infos, config); + reporter.listTags(infos); } - void listReporters(IStreamingReporter& reporter, IConfig const& config) { + void listReporters(IStreamingReporter& reporter) { std::vector descriptions; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); @@ -58,7 +58,7 @@ namespace Catch { descriptions.push_back({ fac.first, fac.second->getDescription() }); } - reporter.listReporters(descriptions, config); + reporter.listReporters(descriptions); } } // end anonymous namespace @@ -96,7 +96,7 @@ namespace Catch { } if (config.listReporters()) { listed = true; - listReporters(reporter, config); + listReporters(reporter); } return listed; } diff --git a/src/catch2/reporters/catch_reporter_combined_tu.cpp b/src/catch2/reporters/catch_reporter_combined_tu.cpp index d9e94aa9..0a15c098 100644 --- a/src/catch2/reporters/catch_reporter_combined_tu.cpp +++ b/src/catch2/reporters/catch_reporter_combined_tu.cpp @@ -100,13 +100,10 @@ namespace Catch { bool EventListenerBase::assertionEnded( AssertionStats const& ) { return false; } - void - EventListenerBase::listReporters( std::vector const&, - IConfig const& ) {} - void EventListenerBase::listTests( std::vector const&, - IConfig const& ) {} - void EventListenerBase::listTags( std::vector const&, - IConfig const& ) {} + void EventListenerBase::listReporters( + std::vector const& ) {} + void EventListenerBase::listTests( std::vector const& ) {} + void EventListenerBase::listTags( std::vector const& ) {} void EventListenerBase::noMatchingTestCases( std::string const& ) {} void EventListenerBase::testRunStarting( TestRunInfo const& ) {} void EventListenerBase::testGroupStarting( GroupInfo const& ) {} diff --git a/src/catch2/reporters/catch_reporter_event_listener.hpp b/src/catch2/reporters/catch_reporter_event_listener.hpp index df089c08..ee65eebd 100644 --- a/src/catch2/reporters/catch_reporter_event_listener.hpp +++ b/src/catch2/reporters/catch_reporter_event_listener.hpp @@ -27,13 +27,10 @@ namespace Catch { void assertionStarting( AssertionInfo const& assertionInfo ) override; bool assertionEnded( AssertionStats const& assertionStats ) override; - void - listReporters( std::vector const& descriptions, - IConfig const& config ) override; - void listTests( std::vector const& tests, - IConfig const& config ) override; - void listTags( std::vector const& tagInfos, - IConfig const& config ) override; + void listReporters( + std::vector const& descriptions ) override; + void listTests( std::vector const& tests ) override; + void listTags( std::vector const& tagInfos ) override; void noMatchingTestCases( std::string const& spec ) override; void testRunStarting( TestRunInfo const& testRunInfo ) override; diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp index 60059c84..d189388b 100644 --- a/src/catch2/reporters/catch_reporter_listening.cpp +++ b/src/catch2/reporters/catch_reporter_listening.cpp @@ -141,25 +141,25 @@ namespace Catch { m_reporter->skipTest( testInfo ); } - void ListeningReporter::listReporters(std::vector const& descriptions, IConfig const& config) { + void ListeningReporter::listReporters(std::vector const& descriptions) { for (auto const& listener : m_listeners) { - listener->listReporters(descriptions, config); + listener->listReporters(descriptions); } - m_reporter->listReporters(descriptions, config); + m_reporter->listReporters(descriptions); } - void ListeningReporter::listTests(std::vector const& tests, IConfig const& config) { + void ListeningReporter::listTests(std::vector const& tests) { for (auto const& listener : m_listeners) { - listener->listTests(tests, config); + listener->listTests(tests); } - m_reporter->listTests(tests, config); + m_reporter->listTests(tests); } - void ListeningReporter::listTags(std::vector const& tags, IConfig const& config) { + void ListeningReporter::listTags(std::vector const& tags) { for (auto const& listener : m_listeners) { - listener->listTags(tags, config); + listener->listTags(tags); } - m_reporter->listTags(tags, config); + m_reporter->listTags(tags); } } // end namespace Catch diff --git a/src/catch2/reporters/catch_reporter_listening.hpp b/src/catch2/reporters/catch_reporter_listening.hpp index c6485300..88234cdc 100644 --- a/src/catch2/reporters/catch_reporter_listening.hpp +++ b/src/catch2/reporters/catch_reporter_listening.hpp @@ -54,9 +54,9 @@ namespace Catch { void skipTest( TestCaseInfo const& testInfo ) override; - void listReporters(std::vector const& descriptions, IConfig const& config) override; - void listTests(std::vector const& tests, IConfig const& config) override; - void listTags(std::vector const& tags, IConfig const& config) override; + void listReporters(std::vector const& descriptions) override; + void listTests(std::vector const& tests) override; + void listTags(std::vector const& tags) override; }; diff --git a/src/catch2/reporters/catch_reporter_xml.cpp b/src/catch2/reporters/catch_reporter_xml.cpp index 06b9739c..273a9689 100644 --- a/src/catch2/reporters/catch_reporter_xml.cpp +++ b/src/catch2/reporters/catch_reporter_xml.cpp @@ -272,7 +272,7 @@ namespace Catch { m_xml.endElement(); } - void XmlReporter::listReporters(std::vector const& descriptions, IConfig const&) { + void XmlReporter::listReporters(std::vector const& descriptions) { auto outerTag = m_xml.scopedElement("AvailableReporters"); for (auto const& reporter : descriptions) { auto inner = m_xml.scopedElement("Reporter"); @@ -285,7 +285,7 @@ namespace Catch { } } - void XmlReporter::listTests(std::vector const& tests, IConfig const&) { + void XmlReporter::listTests(std::vector const& tests) { auto outerTag = m_xml.scopedElement("MatchingTests"); for (auto const& test : tests) { auto innerTag = m_xml.scopedElement("TestCase"); @@ -310,7 +310,7 @@ namespace Catch { } } - void XmlReporter::listTags(std::vector const& tags, IConfig const&) { + void XmlReporter::listTags(std::vector const& tags) { auto outerTag = m_xml.scopedElement("TagsFromMatchingTests"); for (auto const& tag : tags) { auto innerTag = m_xml.scopedElement("Tag"); diff --git a/src/catch2/reporters/catch_reporter_xml.hpp b/src/catch2/reporters/catch_reporter_xml.hpp index 20ee87ff..dbcaaa93 100644 --- a/src/catch2/reporters/catch_reporter_xml.hpp +++ b/src/catch2/reporters/catch_reporter_xml.hpp @@ -56,9 +56,9 @@ namespace Catch { void benchmarkEnded(BenchmarkStats<> const&) override; void benchmarkFailed(std::string const&) override; - void listReporters(std::vector const& descriptions, IConfig const& config) override; - void listTests(std::vector const& tests, IConfig const& config) override; - void listTags(std::vector const& tags, IConfig const& config) override; + void listReporters(std::vector const& descriptions) override; + void listTests(std::vector const& tests) override; + void listTags(std::vector const& tags) override; private: Timer m_testCaseTimer;