Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-08-11 09:34:25 +0200
committerMartin Hořeňovský2020-08-11 09:39:00 +0200
commit6dc834526103e3b9ee7fab26a69cd7942924bd91 (patch)
treed0e24afeb76d611ee61a6b1440e87d1a11e910cb /src
parent24b83edf8aca78c975c5589baf22a5de311498a7 (diff)
downloadcatch3-6dc834526103e3b9ee7fab26a69cd7942924bd91.tar.gz
IStreamingReporter::list* only uses IConfig instead of full Config
As the full `Config` is not needed, the TUs implementing the `list*` functions can require the less heavy header `catch_interfaces_config.hpp` instead of the much heavier `catch_config.hpp`. This commit also fixes up some other TUs that include `Config`, while using just `IConfig`, to cleanup the includes further.
Diffstat (limited to 'src')
-rw-r--r--src/catch2/benchmark/catch_benchmark.hpp2
-rw-r--r--src/catch2/benchmark/catch_execution_plan.hpp2
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.cpp11
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.hpp10
-rw-r--r--src/catch2/internal/catch_list.cpp6
-rw-r--r--src/catch2/reporters/catch_reporter_bases.cpp2
-rw-r--r--src/catch2/reporters/catch_reporter_bases.hpp6
-rw-r--r--src/catch2/reporters/catch_reporter_listening.cpp6
-rw-r--r--src/catch2/reporters/catch_reporter_listening.hpp6
-rw-r--r--src/catch2/reporters/catch_reporter_xml.cpp6
-rw-r--r--src/catch2/reporters/catch_reporter_xml.hpp6
11 files changed, 32 insertions, 31 deletions
diff --git a/src/catch2/benchmark/catch_benchmark.hpp b/src/catch2/benchmark/catch_benchmark.hpp
index cca4bcf0..e14281cf 100644
--- a/src/catch2/benchmark/catch_benchmark.hpp
+++ b/src/catch2/benchmark/catch_benchmark.hpp
@@ -10,7 +10,7 @@
#ifndef TWOBLUECUBES_CATCH_BENCHMARK_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_BENCHMARK_HPP_INCLUDED
-#include <catch2/catch_config.hpp>
+#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/internal/catch_context.hpp>
#include <catch2/interfaces/catch_interfaces_reporter.hpp>
diff --git a/src/catch2/benchmark/catch_execution_plan.hpp b/src/catch2/benchmark/catch_execution_plan.hpp
index dcada8c8..a920cda6 100644
--- a/src/catch2/benchmark/catch_execution_plan.hpp
+++ b/src/catch2/benchmark/catch_execution_plan.hpp
@@ -11,7 +11,7 @@
#ifndef TWOBLUECUBES_CATCH_EXECUTION_PLAN_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_EXECUTION_PLAN_HPP_INCLUDED
-#include <catch2/catch_config.hpp>
+#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_environment.hpp>
#include <catch2/benchmark/detail/catch_benchmark_function.hpp>
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp
index 7e4dd9ef..93a1baad 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.cpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp
@@ -7,7 +7,6 @@
#include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <catch2/interfaces/catch_interfaces_config.hpp>
-#include <catch2/catch_config.hpp>
#include <catch2/internal/catch_console_colour.hpp>
#include <catch2/internal/catch_console_width.hpp>
#include <catch2/catch_message.hpp>
@@ -110,7 +109,7 @@ namespace Catch {
void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
- void IStreamingReporter::listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config) {
+ void IStreamingReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) {
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(); })
@@ -137,10 +136,10 @@ namespace Catch {
Catch::cout() << std::endl;
}
- void IStreamingReporter::listTests(std::vector<TestCaseHandle> const& tests, Config const& config) {
- if (config.hasTestFilters())
+ void IStreamingReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) {
+ if (config.hasTestFilters()) {
Catch::cout() << "Matching test cases:\n";
- else {
+ } else {
Catch::cout() << "All available test cases:\n";
}
@@ -167,7 +166,7 @@ namespace Catch {
}
}
- void IStreamingReporter::listTags(std::vector<TagInfo> const& tags, Config const& config) {
+ void IStreamingReporter::listTags(std::vector<TagInfo> const& tags, IConfig const& config) {
if (config.hasTestFilters()) {
Catch::cout() << "Tags for matching test cases:\n";
} else {
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp
index a8cbbb5d..ba3d1ecd 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp
@@ -234,10 +234,12 @@ namespace Catch {
// Default empty implementation provided
virtual void fatalErrorEncountered( StringRef name );
- // Listing support
- virtual void listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config);
- virtual void listTests(std::vector<TestCaseHandle> const& tests, Config const& config);
- virtual void listTags(std::vector<TagInfo> const& tags, Config const& config);
+ //! Writes out information about provided reporters using reporter-specific format
+ virtual void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config);
+ //! Writes out information about provided tests using reporter-specific format
+ virtual void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config);
+ //! Writes out information about the provided tags using reporter-specific format
+ virtual void listTags(std::vector<TagInfo> const& tags, IConfig const& config);
};
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
diff --git a/src/catch2/internal/catch_list.cpp b/src/catch2/internal/catch_list.cpp
index ab3db4df..3f1208f1 100644
--- a/src/catch2/internal/catch_list.cpp
+++ b/src/catch2/internal/catch_list.cpp
@@ -22,13 +22,13 @@
namespace Catch {
namespace {
- void listTests(IStreamingReporter& reporter, Config const& config) {
+ void listTests(IStreamingReporter& reporter, IConfig const& config) {
auto const& testSpec = config.testSpec();
auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
reporter.listTests(matchedTestCases, config);
}
- void listTags(IStreamingReporter& reporter, Config const& config) {
+ void listTags(IStreamingReporter& reporter, IConfig const& config) {
auto const& testSpec = config.testSpec();
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
@@ -50,7 +50,7 @@ namespace Catch {
reporter.listTags(infos, config);
}
- void listReporters(IStreamingReporter& reporter, Config const& config) {
+ void listReporters(IStreamingReporter& reporter, IConfig const& config) {
std::vector<ReporterDescription> descriptions;
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
diff --git a/src/catch2/reporters/catch_reporter_bases.cpp b/src/catch2/reporters/catch_reporter_bases.cpp
index c8ec9490..08aff91a 100644
--- a/src/catch2/reporters/catch_reporter_bases.cpp
+++ b/src/catch2/reporters/catch_reporter_bases.cpp
@@ -11,7 +11,7 @@
#include <catch2/internal/catch_errno_guard.hpp>
#include <catch2/reporters/catch_reporter_bases.hpp>
#include <catch2/internal/catch_stream.hpp>
-#include <catch2/catch_config.hpp>
+#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <algorithm>
#include <cstring>
diff --git a/src/catch2/reporters/catch_reporter_bases.hpp b/src/catch2/reporters/catch_reporter_bases.hpp
index 165dd2b4..cdf2b227 100644
--- a/src/catch2/reporters/catch_reporter_bases.hpp
+++ b/src/catch2/reporters/catch_reporter_bases.hpp
@@ -159,9 +159,9 @@ namespace Catch {
bool assertionEnded(AssertionStats const&) override;
// Event listeners should not use the default listing impl
- void listReporters(std::vector<ReporterDescription> const&, Config const&) override {}
- void listTests(std::vector<TestCaseHandle> const&, Config const&) override {}
- void listTags(std::vector<TagInfo> const&, Config const&) override {}
+ void listReporters(std::vector<ReporterDescription> const&, IConfig const&) override {}
+ void listTests(std::vector<TestCaseHandle> const&, IConfig const&) override {}
+ void listTags(std::vector<TagInfo> const&, IConfig const&) override {}
};
} // end namespace Catch
diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp
index b4c91205..c0823542 100644
--- a/src/catch2/reporters/catch_reporter_listening.cpp
+++ b/src/catch2/reporters/catch_reporter_listening.cpp
@@ -147,21 +147,21 @@ namespace Catch {
m_reporter->skipTest( testInfo );
}
- void ListeningReporter::listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config) {
+ void ListeningReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) {
for (auto const& listener : m_listeners) {
listener->listReporters(descriptions, config);
}
m_reporter->listReporters(descriptions, config);
}
- void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests, Config const& config) {
+ void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) {
for (auto const& listener : m_listeners) {
listener->listTests(tests, config);
}
m_reporter->listTests(tests, config);
}
- void ListeningReporter::listTags(std::vector<TagInfo> const& tags, Config const& config) {
+ void ListeningReporter::listTags(std::vector<TagInfo> const& tags, IConfig const& config) {
for (auto const& listener : m_listeners) {
listener->listTags(tags, config);
}
diff --git a/src/catch2/reporters/catch_reporter_listening.hpp b/src/catch2/reporters/catch_reporter_listening.hpp
index 8e3a3a52..3aaaa739 100644
--- a/src/catch2/reporters/catch_reporter_listening.hpp
+++ b/src/catch2/reporters/catch_reporter_listening.hpp
@@ -48,9 +48,9 @@ namespace Catch {
void skipTest( TestCaseInfo const& testInfo ) override;
- void listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config) override;
- void listTests(std::vector<TestCaseHandle> const& tests, Config const& config) override;
- void listTags(std::vector<TagInfo> const& tags, Config const& config) override;
+ void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) override;
+ void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) override;
+ void listTags(std::vector<TagInfo> const& tags, IConfig const& config) override;
};
diff --git a/src/catch2/reporters/catch_reporter_xml.cpp b/src/catch2/reporters/catch_reporter_xml.cpp
index 9949ce2a..a576bbec 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<ReporterDescription> const& descriptions, Config const&) {
+ void XmlReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const&) {
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<TestCaseHandle> const& tests, Config const&) {
+ void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const&) {
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<TagInfo> const& tags, Config const&) {
+ void XmlReporter::listTags(std::vector<TagInfo> const& tags, IConfig const&) {
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 c240be3e..30cc57dd 100644
--- a/src/catch2/reporters/catch_reporter_xml.hpp
+++ b/src/catch2/reporters/catch_reporter_xml.hpp
@@ -55,9 +55,9 @@ namespace Catch {
void benchmarkEnded(BenchmarkStats<> const&) override;
void benchmarkFailed(std::string const&) override;
- void listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config) override;
- void listTests(std::vector<TestCaseHandle> const& tests, Config const& config) override;
- void listTags(std::vector<TagInfo> const& tags, Config const& config) override;
+ void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) override;
+ void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) override;
+ void listTags(std::vector<TagInfo> const& tags, IConfig const& config) override;
private:
Timer m_testCaseTimer;