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 5e94498ed0 to the
devel branch.
This commit is contained in:
John Beard 2022-03-05 12:50:48 +00:00 committed by Martin Hořeňovský
parent 2ebc041903
commit f9facc1881
2 changed files with 4 additions and 0 deletions

View File

@ -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" );
}

View File

@ -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 ); };