Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Update catch_reporter_tap.hpp

TAP format requires all results to be reported.
Removed extraneous preferences function (handled by parent)
Incorporated fix from 3d9e7db2e0fff8fc2edcf59d24351f3937e3ac62
Simplified total printing
Commit
87d0197cbdc72a53b2dbbd5fe724ebcaa6fa7500
Author
Gavin S ·
Committer
Martin Hořeňovský
Parents
4565b826cff3

Files · Download .tar.gz

Changes

 src/catch2/reporters/catch_reporter_tap.cpp  |  5 ++---
 src/catch2/reporters/catch_reporter_tap.hpp  | 10 ++++------
 tests/SelfTest/Baselines/tap.sw.approved.txt |  2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/catch2/reporters/catch_reporter_tap.cpp b/src/catch2/reporters/catch_reporter_tap.cpp
index fb8993a2..93da1c17 100644
--- a/src/catch2/reporters/catch_reporter_tap.cpp
+++ b/src/catch2/reporters/catch_reporter_tap.cpp
@@ -209,10 +209,9 @@ namespace Catch {
     }
 
     void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) {
+        stream << "1.." << _testRunStats.totals.assertions.total();
         if (_testRunStats.totals.testCases.total() == 0) {
-            stream << "1..0 # Skipped: No tests ran.";
-        } else {
-            stream << "1.." << counter;
+            stream << " # Skipped: No tests ran.";
         }
         stream << "\n\n" << std::flush;
         StreamingReporterBase::testRunEnded(_testRunStats);
diff --git a/src/catch2/reporters/catch_reporter_tap.hpp b/src/catch2/reporters/catch_reporter_tap.hpp
index 1ede76fb..651d2b20 100644
--- a/src/catch2/reporters/catch_reporter_tap.hpp
+++ b/src/catch2/reporters/catch_reporter_tap.hpp
@@ -11,8 +11,10 @@ namespace Catch {
 
     struct TAPReporter : StreamingReporterBase {
 
-        using StreamingReporterBase::StreamingReporterBase;
-
+        TAPReporter( ReporterConfig const& config ):
+            StreamingReporterBase( config ) {
+            m_reporterPrefs.shouldReportAllAssertions = true;
+        }
         ~TAPReporter() override;
 
         static std::string getDescription() {
@@ -20,10 +22,6 @@ namespace Catch {
             return "Reports test results in TAP format, suitable for test harnesses"s;
         }
 
-        ReporterPreferences getPreferences() const override {
-            return m_reporterPrefs;
-        }
-
         void noMatchingTestCases(std::string const& spec) override;
 
         void assertionStarting( AssertionInfo const& ) override {}
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index 8f615e30..c1e5b5e9 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -3992,5 +3992,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
 ok {test-number} -
 # xmlentitycheck
 ok {test-number} -
-1..1992
+1..2000