diff options
| author | Martin Hořeňovský | 2020-02-01 20:55:42 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-02-16 16:02:31 +0100 |
| commit | f8794634c286810ee97544e1e4ea0cbd1555d66d (patch) | |
| tree | 54f9ff713fbc957c5e996b40ad43bf5fb47c2e0a /tests/SelfTest/UsageTests/Matchers.tests.cpp | |
| parent | d6b2a3793b6693ac8f51283f6e22cfed9f1eb230 (diff) | |
| download | catch3-f8794634c286810ee97544e1e4ea0cbd1555d66d.tar.gz | |
Fix significant bug with storing composed matchers
Given that in the 2 or so years that matchers are thing nobody complained,
it seems that people do not actually write this sort of code, and the
possibility will be removed in v3. However, to avoid correctness bugs,
we will have to support this weird code in v2.
Diffstat (limited to 'tests/SelfTest/UsageTests/Matchers.tests.cpp')
| -rw-r--r-- | tests/SelfTest/UsageTests/Matchers.tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index e10e98ca..e5c28ef9 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -556,6 +556,16 @@ namespace { namespace MatchersTests { REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, Message("SpecialException::what")); } + TEST_CASE("Composed matchers are distinct", "[matchers][composed]") { + auto m1 = Contains("string"); + auto m2 = Contains("random"); + auto composed1 = m1 || m2; + auto m3 = Contains("different"); + auto composed2 = composed1 || m3; + REQUIRE_THAT(testStringForMatching2(), !composed1); + REQUIRE_THAT(testStringForMatching2(), composed2); + } + template<typename Range> struct EqualsRangeMatcher : Catch::MatcherGenericBase { |