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
This commit is contained in:
Martin Hořeňovský
2021-09-23 23:28:59 +02:00
parent f02c2678a1
commit 426954032f
17 changed files with 275 additions and 275 deletions

View File

@@ -35,10 +35,10 @@ operators, that is `&&`, `||`, and `!`, like so:
```cpp
using Catch::Matchers::EndsWith;
using Catch::Matchers::Contains;
using Catch::Matchers::ContainsSubstring;
REQUIRE_THAT( getSomeString(),
EndsWith("as a service") && Contains("web scale"));
EndsWith("as a service") && ContainsSubstring("web scale"));
```
The example above asserts that the string returned from `getSomeString`
@@ -64,7 +64,7 @@ TEST_CASE("Bugs, bugs, bugs", "[Bug]"){
std::string str = "Bugs as a service";
auto match_expression = Catch::Matchers::EndsWith( "as a service" ) ||
(Catch::Matchers::StartsWith( "Big data" ) && !Catch::Matchers::Contains( "web scale" ) );
(Catch::Matchers::StartsWith( "Big data" ) && !Catch::Matchers::ContainsSubstring( "web scale" ) );
REQUIRE_THAT(str, match_expression);
}
```
@@ -88,7 +88,7 @@ Out of the box, Catch2 provides the following matchers:
Catch2 provides 5 different matchers that work with `std::string`,
* `StartsWith(std::string str, CaseSensitive)`,
* `EndsWith(std::string str, CaseSensitive)`,
* `Contains(std::string str, CaseSensitive)`,
* `ContainsSubstring(std::string str, CaseSensitive)`,
* `Equals(std::string str, CaseSensitive)`, and
* `Matches(std::string str, CaseSensitive)`.