From f9facc188142f545e34cb8b12e540eed18b30810 Mon Sep 17 00:00:00 2001 From: John Beard Date: Sat, 5 Mar 2022 12:50:48 +0000 Subject: [PATCH] Add variadic CAPTURE tests This makes sure that CAPTURE works when called with variadic arguments, and also works that way when disabled. The underlying fix to #2316 is not applicable (CAPTURE is already variadic when disabled). This is a port of 5e94498ed04820b1022f0bead0f7d4d5fb7a06dd to the devel branch. --- tests/ExtraTests/X01-PrefixedMacros.cpp | 1 + tests/ExtraTests/X02-DisabledMacros.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tests/ExtraTests/X01-PrefixedMacros.cpp b/tests/ExtraTests/X01-PrefixedMacros.cpp index ff6e8cbe..65235194 100644 --- a/tests/ExtraTests/X01-PrefixedMacros.cpp +++ b/tests/ExtraTests/X01-PrefixedMacros.cpp @@ -66,6 +66,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/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp index e870a692..aea3b1a3 100644 --- a/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/tests/ExtraTests/X02-DisabledMacros.cpp @@ -52,6 +52,9 @@ TEST_CASE( "Disabled Macros" ) { STATIC_CHECK( 0 == 1 ); STATIC_REQUIRE( !true ); + CAPTURE( 1 ); + CAPTURE( 1, "captured" ); + REQUIRE_THAT( 1, Catch::Matchers::Predicate( []( int ) { return false; } ) ); BENCHMARK( "Disabled benchmark" ) { REQUIRE( 1 == 2 ); };