Remove obsoleted utility functions on matchers

Natural operators, &&, || and ! are preferred and do not have
limited arity.
This commit is contained in:
Martin Hořeňovský 2017-08-30 19:16:25 +02:00
parent 97edf7ce65
commit a4df0b2c37
3 changed files with 3 additions and 35 deletions

View File

@ -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

View File

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

View File

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