Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohn Beard2022-03-05 12:50:48 +0000
committerMartin Hořeňovský2022-03-05 16:06:54 +0100
commitf9facc188142f545e34cb8b12e540eed18b30810 (patch)
treebbe5a59a2fdd2fa946a4c103916aa0daf8748306
parent2ebc04190310ca741ff234be78701e6b6fa0a95f (diff)
downloadcatch3-f9facc188142f545e34cb8b12e540eed18b30810.tar.gz
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.
-rw-r--r--tests/ExtraTests/X01-PrefixedMacros.cpp1
-rw-r--r--tests/ExtraTests/X02-DisabledMacros.cpp3
2 files changed, 4 insertions, 0 deletions
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 ); };