From 4f72202c040ac02b9dcee0166faea514775b2127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Garc=C3=ADa=20Salom=C3=B3n?= Date: Sun, 23 Jul 2017 17:13:44 +0200 Subject: [PATCH] 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 --- 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 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;