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

Move sectionInfo into sectionEndInfo when SECTION ends

When running `./tests/SelfTest -o /dev/null`, this saves 468
allocations (438907 -> 437439). In general, this saves 1 allocation
every time an entered `SECTION` ends and the section name was long
enough to move out of the SSO buffer.
Commit
d58491c85a534a9348634ac3e4eb384df22f4d71
Author
Martin Hořeňovský ·
Parents
c837cb4a8aaa

Files · Download .tar.gz

Changes

 src/catch2/internal/catch_section.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/catch2/internal/catch_section.cpp b/src/catch2/internal/catch_section.cpp
index ca2e5d8c..63b4abd3 100644
--- a/src/catch2/internal/catch_section.cpp
+++ b/src/catch2/internal/catch_section.cpp
@@ -25,7 +25,7 @@ namespace Catch {
 
     Section::~Section() {
         if( m_sectionIncluded ) {
-            SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() };
+            SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() };
             if( uncaught_exceptions() )
                 getResultCapture().sectionEndedEarly( endInfo );
             else