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

Fix for JUnit reporter when using dynamically generated sections (#963)

* BySectionInfo should also take into account the section name in addition to the source code line
Commit
4f72202c040ac02b9dcee0166faea514775b2127
Author
Fran García Salomón ·
Committer
Martin Hořeňovský
Parents
cde987a92ee6

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_bases.hpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp
index 6d627839..5e86e7c2 100644
--- a/include/reporters/catch_reporter_bases.hpp
+++ b/include/reporters/catch_reporter_bases.hpp
@@ -125,10 +125,11 @@ namespace Catch {
         };
 
         struct BySectionInfo {
-            BySectionInfo(SectionInfo const& other) : m_other(other) {}
-            BySectionInfo(BySectionInfo const& other) : m_other(other.m_other) {}
+            BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
+            BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}
             bool operator() (std::shared_ptr<SectionNode> const& node) const {
-                return node->stats.sectionInfo.lineInfo == m_other.lineInfo;
+                return ((node->stats.sectionInfo.name == m_other.name) &&
+                        (node->stats.sectionInfo.lineInfo == m_other.lineInfo));
             }
             void operator=(BySectionInfo const&) = delete;