diff options
| author | Martin Hořeňovský | 2021-09-23 23:28:59 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-09-27 21:28:33 +0200 |
| commit | 426954032f263754d2fff4cffce8552e7371965e (patch) | |
| tree | b5af0b991802f3624a1f99e503b1ab859a6d91d3 /tests/SelfTest/UsageTests | |
| parent | f02c2678a1a891f9577712fe160c1f6f3baef3a8 (diff) | |
| download | catch3-426954032f263754d2fff4cffce8552e7371965e.tar.gz | |
Rename Contains string matcher builder to ContainsSubstring
The problem with the old name was that it collided with the
range matcher `Contains`, and it was not really possible to
disambiguate them just with argument types.
Closes #2131
Diffstat (limited to 'tests/SelfTest/UsageTests')
| -rw-r--r-- | tests/SelfTest/UsageTests/Exception.tests.cpp | 4 | ||||
| -rw-r--r-- | tests/SelfTest/UsageTests/Matchers.tests.cpp | 36 |
2 files changed, 20 insertions, 20 deletions
diff --git a/tests/SelfTest/UsageTests/Exception.tests.cpp b/tests/SelfTest/UsageTests/Exception.tests.cpp index 206bd9c8..9b4ea030 100644 --- a/tests/SelfTest/UsageTests/Exception.tests.cpp +++ b/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -167,8 +167,8 @@ TEST_CASE( "Exception messages can be tested for", "[!throws]" ) { SECTION( "wildcarded" ) { REQUIRE_THROWS_WITH( thisThrows(), StartsWith( "expected" ) ); REQUIRE_THROWS_WITH( thisThrows(), EndsWith( "exception" ) ); - REQUIRE_THROWS_WITH( thisThrows(), Contains( "except" ) ); - REQUIRE_THROWS_WITH( thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) ); + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "except" ) ); + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "exCept", Catch::CaseSensitive::No ) ); } } diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index 6f83279f..75578d68 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -105,12 +105,12 @@ namespace { } // end unnamed namespace TEST_CASE( "String matchers", "[matchers]" ) { - REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ); + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string" ) ); REQUIRE_THAT( testStringForMatching(), - Contains( "string", Catch::CaseSensitive::No ) ); - CHECK_THAT( testStringForMatching(), Contains( "abc" ) ); + ContainsSubstring( "string", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), ContainsSubstring( "abc" ) ); CHECK_THAT( testStringForMatching(), - Contains( "aBC", Catch::CaseSensitive::No ) ); + ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ); CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ); CHECK_THAT( testStringForMatching(), @@ -122,8 +122,8 @@ TEST_CASE( "String matchers", "[matchers]" ) { TEST_CASE( "Contains string matcher", "[.][failing][matchers]" ) { CHECK_THAT( testStringForMatching(), - Contains( "not there", Catch::CaseSensitive::No ) ); - CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ); + ContainsSubstring( "not there", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ); } TEST_CASE( "StartsWith string matcher", "[.][failing][matchers]" ) { @@ -185,42 +185,42 @@ TEST_CASE( "Regex string matcher", "[matchers][.failing]" ) { TEST_CASE( "Matchers can be (AllOf) composed with the && operator", "[matchers][operators][operator&&]" ) { CHECK_THAT( testStringForMatching(), - Contains( "string" ) && Contains( "abc" ) && - Contains( "substring" ) && Contains( "contains" ) ); + ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && + ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) ); } TEST_CASE( "Matchers can be (AnyOf) composed with the || operator", "[matchers][operators][operator||]" ) { CHECK_THAT( testStringForMatching(), - Contains( "string" ) || Contains( "different" ) || - Contains( "random" ) ); + ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || + ContainsSubstring( "random" ) ); CHECK_THAT( testStringForMatching2(), - Contains( "string" ) || Contains( "different" ) || - Contains( "random" ) ); + ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || + ContainsSubstring( "random" ) ); } TEST_CASE( "Matchers can be composed with both && and ||", "[matchers][operators][operator||][operator&&]" ) { CHECK_THAT( testStringForMatching(), - ( Contains( "string" ) || Contains( "different" ) ) && - Contains( "substring" ) ); + ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && + ContainsSubstring( "substring" ) ); } TEST_CASE( "Matchers can be composed with both && and || - failing", "[matchers][operators][operator||][operator&&][.failing]" ) { CHECK_THAT( testStringForMatching(), - ( Contains( "string" ) || Contains( "different" ) ) && - Contains( "random" ) ); + ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && + ContainsSubstring( "random" ) ); } TEST_CASE( "Matchers can be negated (Not) with the ! operator", "[matchers][operators][not]" ) { - CHECK_THAT( testStringForMatching(), !Contains( "different" ) ); + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "different" ) ); } TEST_CASE( "Matchers can be negated (Not) with the ! operator - failing", "[matchers][operators][not][.failing]" ) { - CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ); + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ); } template <typename T> struct CustomAllocator : private std::allocator<T> { |