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 /docs | |
| 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 'docs')
| -rw-r--r-- | docs/matchers.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/matchers.md b/docs/matchers.md index 6fdb15bf..e76d8490 100644 --- a/docs/matchers.md +++ b/docs/matchers.md @@ -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)`. |