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.
This commit is contained in:
Martin Hořeňovský committed 2020-08-11 09:39:00 +02:00
1 parent 24b83edf8a
commit 6dc8345261
11 files changed
+32 -31

No files matched your search

@@ -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 {
@@ -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>;