Skip to content

Commit

Permalink
Fix: CAPTURE not variadic when disabled (#2378)
Browse files Browse the repository at this point in the history
Closes: #2316
  • Loading branch information
johnbeard authored Mar 4, 2022
1 parent 958944d commit ff151d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/catch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_ ))
Expand Down
1 change: 1 addition & 0 deletions projects/ExtraTests/X01-PrefixedMacros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
}
Expand Down
4 changes: 4 additions & 0 deletions projects/ExtraTests/X02-DisabledMacros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit ff151d2

Please sign in to comment.