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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/interfaces
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-01-16 15:48:22 +0100
committerMartin Hořeňovský2021-01-16 15:48:29 +0100
commit5509ceff608aafc402116a081200f3ff2b4805ed (patch)
tree4357e9fecf9129b616572adccb9bfa3ecec90327 /src/catch2/interfaces
parent74f2f4ba5e84355e4f123ec807c1ec3b29a0daa7 (diff)
downloadcatch3-5509ceff608aafc402116a081200f3ff2b4805ed.tar.gz
Remove superfluous IConfig argument from IStreamingReporter::list*
The previous commit made it so that the `IConfig` is stored in `IStreamingReporter` and thus always available.
Diffstat (limited to 'src/catch2/interfaces')
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.cpp21
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.hpp6
2 files changed, 14 insertions, 13 deletions
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<ReporterDescription> const& descriptions, IConfig const& config) {
+ void IStreamingReporter::listReporters(std::vector<ReporterDescription> 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<TestCaseHandle> const& tests, IConfig const& config) {
+ void IStreamingReporter::listTests(std::vector<TestCaseHandle> 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<TagInfo> const& tags, IConfig const& config) {
- if (config.hasTestFilters()) {
+ void IStreamingReporter::listTags(std::vector<TagInfo> 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<ReporterDescription> const& descriptions, IConfig const& config);
+ virtual void listReporters(std::vector<ReporterDescription> const& descriptions);
//! Writes out information about provided tests using reporter-specific format
- virtual void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config);
+ virtual void listTests(std::vector<TestCaseHandle> const& tests);
//! Writes out information about the provided tags using reporter-specific format
- virtual void listTags(std::vector<TagInfo> const& tags, IConfig const& config);
+ virtual void listTags(std::vector<TagInfo> const& tags);
};
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;