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

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-07-26 21:31:29 +0200
committerMartin Hořeňovský2020-07-26 21:31:29 +0200
commit5ca68829e10cc28471d2340439b53a41e8ff4e63 (patch)
tree7b223ca9220ee3b7038cade14356b46a34008345 /tests/SelfTest/UsageTests
parentac54ba7e12b77a4d88a42ee19cb193c4bd3c33ad (diff)
downloadcatch3-5ca68829e10cc28471d2340439b53a41e8ff4e63.tar.gz
Refactor how shortcircuiting of old style matchers is tested
Diffstat (limited to 'tests/SelfTest/UsageTests')
-rw-r--r--tests/SelfTest/UsageTests/Matchers.tests.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp
index 8276cf84..b627d4a9 100644
--- a/tests/SelfTest/UsageTests/Matchers.tests.cpp
+++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp
@@ -638,22 +638,24 @@ namespace { namespace MatchersTests {
TEST_CASE("Composed matchers shortcircuit", "[matchers][composed]") {
// Check that if first returns false, second is not touched
CheckedTestingMatcher first, second;
- SECTION("&&") {
+ SECTION("MatchAllOf") {
first.matchSucceeds = false;
- // This assertion doesn't actually test anything, we just
- // want the composed matcher's `match` being called.
- CHECK_THAT(1, !(first && second));
+
+ Detail::MatchAllOf<int> matcher =
+ Detail::MatchAllOf<int>{} && first && second;
+ CHECK_FALSE( matcher.match( 1 ) );
// These two assertions are the important ones
REQUIRE(first.matchCalled);
REQUIRE(!second.matchCalled);
}
// Check that if first returns true, second is not touched
- SECTION("||") {
+ SECTION("MatchAnyOf") {
first.matchSucceeds = true;
- // This assertion doesn't actually test anything, we just
- // want the composed matcher's `match` being called.
- CHECK_THAT(1, first || second);
+
+ Detail::MatchAnyOf<int> matcher =
+ Detail::MatchAnyOf<int>{} || first || second;
+ CHECK( matcher.match( 1 ) );
// These two assertions are the important ones
REQUIRE(first.matchCalled);