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

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2018-07-14 20:51:02 +0200
committerMartin Hořeňovský2018-07-14 20:51:02 +0200
commitd6c7392b24ef9a74b4a3abe0445b7fad0e3bea4e (patch)
tree949c4256d1994f63f5c74fcdfaab6080d534f07b /include
parent9ee4c1db5294a7245920bbbf93e85aa47e646595 (diff)
downloadcatch3-d6c7392b24ef9a74b4a3abe0445b7fad0e3bea4e.tar.gz
Add a new reporter customization point: reporting all assertions
By opting the JUnit and XML reporters into it, we no longer run into problem where they underreport the results without `-s` flag. Related to #1264, #1267, #1310
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_interfaces_reporter.h1
-rw-r--r--include/internal/catch_run_context.cpp2
-rw-r--r--include/reporters/catch_reporter_compact.cpp4
-rw-r--r--include/reporters/catch_reporter_junit.cpp1
-rw-r--r--include/reporters/catch_reporter_tap.hpp4
-rw-r--r--include/reporters/catch_reporter_xml.cpp1
6 files changed, 6 insertions, 7 deletions
diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h
index 76f5fd5a..9d99c981 100644
--- a/include/internal/catch_interfaces_reporter.h
+++ b/include/internal/catch_interfaces_reporter.h
@@ -42,6 +42,7 @@ namespace Catch {
struct ReporterPreferences {
bool shouldRedirectStdOut = false;
+ bool shouldReportAllAssertions = false;
};
template<typename T>
diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp
index 73558521..ecaa34db 100644
--- a/include/internal/catch_run_context.cpp
+++ b/include/internal/catch_run_context.cpp
@@ -17,7 +17,7 @@ namespace Catch {
m_config(_config),
m_reporter(std::move(reporter)),
m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal },
- m_includeSuccessfulResults( m_config->includeSuccessfulResults() )
+ m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )
{
m_context.setRunner(this);
m_context.setConfig(m_config);
diff --git a/include/reporters/catch_reporter_compact.cpp b/include/reporters/catch_reporter_compact.cpp
index caf4d3f9..65f70266 100644
--- a/include/reporters/catch_reporter_compact.cpp
+++ b/include/reporters/catch_reporter_compact.cpp
@@ -245,9 +245,7 @@ private:
}
ReporterPreferences CompactReporter::getPreferences() const {
- ReporterPreferences prefs;
- prefs.shouldRedirectStdOut = false;
- return prefs;
+ return m_reporterPrefs;
}
void CompactReporter::noMatchingTestCases( std::string const& spec ) {
diff --git a/include/reporters/catch_reporter_junit.cpp b/include/reporters/catch_reporter_junit.cpp
index 55129b76..03dc35c1 100644
--- a/include/reporters/catch_reporter_junit.cpp
+++ b/include/reporters/catch_reporter_junit.cpp
@@ -62,6 +62,7 @@ namespace Catch {
xml( _config.stream() )
{
m_reporterPrefs.shouldRedirectStdOut = true;
+ m_reporterPrefs.shouldReportAllAssertions = true;
}
JunitReporter::~JunitReporter() {}
diff --git a/include/reporters/catch_reporter_tap.hpp b/include/reporters/catch_reporter_tap.hpp
index 19e54ed1..ccc4051b 100644
--- a/include/reporters/catch_reporter_tap.hpp
+++ b/include/reporters/catch_reporter_tap.hpp
@@ -30,9 +30,7 @@ namespace Catch {
}
ReporterPreferences getPreferences() const override {
- ReporterPreferences prefs;
- prefs.shouldRedirectStdOut = false;
- return prefs;
+ return m_reporterPrefs;
}
void noMatchingTestCases( std::string const& spec ) override {
diff --git a/include/reporters/catch_reporter_xml.cpp b/include/reporters/catch_reporter_xml.cpp
index b6c7d052..c3200537 100644
--- a/include/reporters/catch_reporter_xml.cpp
+++ b/include/reporters/catch_reporter_xml.cpp
@@ -24,6 +24,7 @@ namespace Catch {
m_xml(_config.stream())
{
m_reporterPrefs.shouldRedirectStdOut = true;
+ m_reporterPrefs.shouldReportAllAssertions = true;
}
XmlReporter::~XmlReporter() = default;