Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Remove obsoleted utility functions on matchers

Natural operators, &&, || and ! are preferred and do not have
limited arity.
Commit
a4df0b2c37f4f474aa0c379c484659300d315def
Author
Martin Hořeňovský ·
Parents
97edf7ce65e8

Files · Download .tar.gz

Changes

 docs/release-notes.md               |  3 +++
 include/internal/catch_matchers.hpp | 25 -------------------------
 projects/SelfTest/MatchersTests.cpp | 10 ----------
 3 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/docs/release-notes.md b/docs/release-notes.md
index aa8f4957..c790e066 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -17,6 +17,9 @@
 * `*_THROWS_AS(expr, exception_type)` now unconditionally appends `const&` to the exception type.
 * `CATCH_CONFIG_FAST_COMPILE` now affects the `CHECK_` family of assertions as well as `REQUIRE_` family of assertions
   * This is most noticeable in `CHECK(throws())`, which would previously report failure, properly stringify the exception and continue. Now it will report failure and stop executing current section.
+* Removed deprecated matcher utility functions `Not`, `AllOf` and `AnyOf`.
+  * They are superseded by operators `!`, `&&` and `||`, which are natural and do not have limited arity
+
 
 ## Improvements
 * Reporters and Listeners can be defined in files different from the main file
diff --git a/include/internal/catch_matchers.hpp b/include/internal/catch_matchers.hpp
index 5a3f0818..91923831 100644
--- a/include/internal/catch_matchers.hpp
+++ b/include/internal/catch_matchers.hpp
@@ -148,31 +148,6 @@ namespace Matchers {
 
     } // namespace Impl
 
-
-    // The following functions create the actual matcher objects.
-    // This allows the types to be inferred
-    // - deprecated: prefer ||, && and !
-    template<typename T>
-    Impl::MatchNotOf<T> Not( Impl::MatcherBase<T> const& underlyingMatcher ) {
-        return Impl::MatchNotOf<T>( underlyingMatcher );
-    }
-    template<typename T>
-    Impl::MatchAllOf<T> AllOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2 ) {
-        return Impl::MatchAllOf<T>() && m1 && m2;
-    }
-    template<typename T>
-    Impl::MatchAllOf<T> AllOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2, Impl::MatcherBase<T> const& m3 ) {
-        return Impl::MatchAllOf<T>() && m1 && m2 && m3;
-    }
-    template<typename T>
-    Impl::MatchAnyOf<T> AnyOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2 ) {
-        return Impl::MatchAnyOf<T>() || m1 || m2;
-    }
-    template<typename T>
-    Impl::MatchAnyOf<T> AnyOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2, Impl::MatcherBase<T> const& m3 ) {
-        return Impl::MatchAnyOf<T>() || m1 || m2 || m3;
-    }
-
 } // namespace Matchers
 
 using namespace Matchers;
diff --git a/projects/SelfTest/MatchersTests.cpp b/projects/SelfTest/MatchersTests.cpp
index 52a49230..0482ed43 100644
--- a/projects/SelfTest/MatchersTests.cpp
+++ b/projects/SelfTest/MatchersTests.cpp
@@ -50,16 +50,6 @@ TEST_CASE("Equals string matcher", "[.][failing][matchers]")
     CHECK_THAT( testStringForMatching(), Equals( "something else" ) );
 }
 
-TEST_CASE("AllOf matcher", "[matchers]")
-{
-    CHECK_THAT( testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) );
-}
-TEST_CASE("AnyOf matcher", "[matchers]")
-{
-    CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) );
-    CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) );
-}
-
 TEST_CASE("Equals", "[matchers]")
 {
     CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) );