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

Use plain pointer to point to deepest section in CumulativeReporterBase

Part of #2089
Commit
79c1bf93019ef3d8dc9d2bd905836f470e75a20c
Author
Martin Hořeňovský ·
Parents
4f14922aa38f

Files · Download .tar.gz

Changes

 src/catch2/reporters/catch_reporter_cumulative_base.cpp | 5 +++--
 src/catch2/reporters/catch_reporter_cumulative_base.hpp | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/src/catch2/reporters/catch_reporter_cumulative_base.cpp
index dcb57fc2..b4824148 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.cpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.cpp
@@ -58,8 +58,9 @@ namespace Catch {
                 node = *it;
             }
         }
-        m_sectionStack.push_back( node );
-        m_deepestSection = std::move( node );
+
+        m_deepestSection = node.get();
+        m_sectionStack.push_back( std::move(node) );
     }
 
     bool CumulativeReporterBase::assertionEnded(
diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
index 8897523e..dc50a98a 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.hpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
@@ -81,7 +81,7 @@ namespace Catch {
         std::vector<Detail::unique_ptr<TestRunNode>> m_testRuns;
 
         std::shared_ptr<SectionNode> m_rootSection;
-        std::shared_ptr<SectionNode> m_deepestSection;
+        SectionNode* m_deepestSection = nullptr;
         std::vector<std::shared_ptr<SectionNode>> m_sectionStack;
     };