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: CAPTURE not variadic when disabled (#2378)

Closes: #2316
Commit
ff151d2833d48aa630564859cd1401a93a2bb333
Author
John Beard ·
Committer
GitHub
Parents
958944d27a2d

Files · Download .tar.gz

Changes

 include/catch.hpp                          | 2 +-
 projects/ExtraTests/X01-PrefixedMacros.cpp | 1 +
 projects/ExtraTests/X02-DisabledMacros.cpp | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/catch.hpp b/include/catch.hpp
index dbcb9495..e027712b 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -433,7 +433,7 @@ using Catch::Detail::Approx;
 #define INFO( msg ) (void)(0)
 #define UNSCOPED_INFO( msg ) (void)(0)
 #define WARN( msg ) (void)(0)
-#define CAPTURE( msg ) (void)(0)
+#define CAPTURE( ... ) (void)(0)
 
 #define TEST_CASE( ... )  INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
 #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
diff --git a/projects/ExtraTests/X01-PrefixedMacros.cpp b/projects/ExtraTests/X01-PrefixedMacros.cpp
index 3d2ab9c1..4a4d4293 100644
--- a/projects/ExtraTests/X01-PrefixedMacros.cpp
+++ b/projects/ExtraTests/X01-PrefixedMacros.cpp
@@ -53,6 +53,7 @@ CATCH_TEST_CASE("PrefixedMacros") {
     CATCH_SECTION("some section") {
         int i = 1;
         CATCH_CAPTURE( i );
+        CATCH_CAPTURE( i, i + 1 );
         CATCH_DYNAMIC_SECTION("Dynamic section: " << i) {
             CATCH_FAIL_CHECK( "failure" );
         }
diff --git a/projects/ExtraTests/X02-DisabledMacros.cpp b/projects/ExtraTests/X02-DisabledMacros.cpp
index 3a969d76..2669145d 100644
--- a/projects/ExtraTests/X02-DisabledMacros.cpp
+++ b/projects/ExtraTests/X02-DisabledMacros.cpp
@@ -26,6 +26,10 @@ foo f;
 
 // This test should not be run, because it won't be registered
 TEST_CASE( "Disabled Macros" ) {
+
+    CAPTURE( 1 );
+    CAPTURE( 1, "captured" );
+
     std::cout << "This should not happen\n";
     FAIL();
 }