Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/IntrospectiveTests
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-09-23 23:28:59 +0200
committerMartin Hořeňovský2021-09-27 21:28:33 +0200
commit426954032f263754d2fff4cffce8552e7371965e (patch)
treeb5af0b991802f3624a1f99e503b1ab859a6d91d3 /tests/SelfTest/IntrospectiveTests
parentf02c2678a1a891f9577712fe160c1f6f3baef3a8 (diff)
downloadcatch3-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/IntrospectiveTests')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp8
-rw-r--r--tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp20
-rw-r--r--tests/SelfTest/IntrospectiveTests/Tag.tests.cpp8
-rw-r--r--tests/SelfTest/IntrospectiveTests/Xml.tests.cpp6
4 files changed, 21 insertions, 21 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index e8bf6e5f..c1fd6527 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -406,7 +406,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
auto result = cli.parse({"test", "--reporter", "unsupported"});
CHECK(!result);
- REQUIRE_THAT(result.errorMessage(), Contains("Unrecognized reporter"));
+ REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Unrecognized reporter"));
}
}
@@ -438,7 +438,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
SECTION("-x must be numeric") {
auto result = cli.parse({"test", "-x", "oops"});
CHECK(!result);
- REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops"));
+ REQUIRE_THAT(result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops"));
}
SECTION("wait-for-keypress") {
@@ -460,7 +460,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
CHECK(!result);
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
- REQUIRE_THAT(result.errorMessage(), Contains("never") && Contains("both"));
+ REQUIRE_THAT(result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both"));
#endif
}
}
@@ -534,7 +534,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
SECTION( "error" ) {
auto result = cli.parse({"test", "--use-colour", "wrong"});
CHECK( !result );
- CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) );
+ CHECK_THAT( result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) );
}
}
diff --git a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
index c5c97998..69d05eef 100644
--- a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
@@ -21,7 +21,7 @@
TEST_CASE( "The default listing implementation write to provided stream",
"[reporters][reporter-helpers]" ) {
- using Catch::Matchers::Contains;
+ using Catch::Matchers::ContainsSubstring;
using namespace std::string_literals;
std::stringstream sstream;
@@ -31,7 +31,7 @@ TEST_CASE( "The default listing implementation write to provided stream",
Catch::defaultListTags(sstream, tags, false);
auto listingString = sstream.str();
- REQUIRE_THAT(listingString, Contains("[fakeTag]"s));
+ REQUIRE_THAT(listingString, ContainsSubstring("[fakeTag]"s));
}
SECTION( "Listing reporters" ) {
std::vector<Catch::ReporterDescription> reporters(
@@ -39,7 +39,7 @@ TEST_CASE( "The default listing implementation write to provided stream",
Catch::defaultListReporters(sstream, reporters, Catch::Verbosity::Normal);
auto listingString = sstream.str();
- REQUIRE_THAT(listingString, Contains("fake reporter"s));
+ REQUIRE_THAT(listingString, ContainsSubstring("fake reporter"s));
}
SECTION( "Listing tests" ) {
Catch::TestCaseInfo fakeInfo{
@@ -51,13 +51,13 @@ TEST_CASE( "The default listing implementation write to provided stream",
auto listingString = sstream.str();
REQUIRE_THAT( listingString,
- Contains( "fake test name"s ) &&
- Contains( "fakeTestTag"s ) );
+ ContainsSubstring( "fake test name"s ) &&
+ ContainsSubstring( "fakeTestTag"s ) );
}
}
TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) {
- using Catch::Matchers::Contains;
+ using Catch::Matchers::ContainsSubstring;
using namespace std::string_literals;
auto const& factories = Catch::getRegistryHub().getReporterRegistry().getFactories();
@@ -80,7 +80,7 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) {
reporter->listTags(tags);
auto listingString = sstream.str();
- REQUIRE_THAT(listingString, Contains("fakeTag"s));
+ REQUIRE_THAT(listingString, ContainsSubstring("fakeTag"s));
}
DYNAMIC_SECTION( factory.first << " reporter lists reporters" ) {
@@ -89,7 +89,7 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) {
reporter->listReporters(reporters);
auto listingString = sstream.str();
- REQUIRE_THAT(listingString, Contains("fake reporter"s));
+ REQUIRE_THAT(listingString, ContainsSubstring("fake reporter"s));
}
DYNAMIC_SECTION( factory.first << " reporter lists tests" ) {
@@ -102,8 +102,8 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) {
auto listingString = sstream.str();
REQUIRE_THAT( listingString,
- Contains( "fake test name"s ) &&
- Contains( "fakeTestTag"s ) );
+ ContainsSubstring( "fake test name"s ) &&
+ ContainsSubstring( "fakeTestTag"s ) );
}
}
}
diff --git a/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp b/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp
index a74b3159..2feffa44 100644
--- a/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp
@@ -24,10 +24,10 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) {
catch( std::exception& ex ) {
std::string what = ex.what();
using namespace Catch::Matchers;
- CHECK_THAT( what, Contains( "[@zzz]" ) );
- CHECK_THAT( what, Contains( "file" ) );
- CHECK_THAT( what, Contains( "2" ) );
- CHECK_THAT( what, Contains( "10" ) );
+ CHECK_THAT( what, ContainsSubstring( "[@zzz]" ) );
+ CHECK_THAT( what, ContainsSubstring( "file" ) );
+ CHECK_THAT( what, ContainsSubstring( "2" ) );
+ CHECK_THAT( what, ContainsSubstring( "10" ) );
}
}
diff --git a/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp b/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp
index c98d66ef..0459c579 100644
--- a/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp
@@ -117,7 +117,7 @@ TEST_CASE("XmlEncode: UTF-8", "[XML][UTF-8][approvals]") {
}
TEST_CASE("XmlWriter writes boolean attributes as true/false", "[XML][XmlWriter]") {
- using Catch::Matchers::Contains;
+ using Catch::Matchers::ContainsSubstring;
std::stringstream stream;
{
Catch::XmlWriter xml(stream);
@@ -128,6 +128,6 @@ TEST_CASE("XmlWriter writes boolean attributes as true/false", "[XML][XmlWriter]
}
REQUIRE_THAT( stream.str(),
- Contains(R"(attr1="true")") &&
- Contains(R"(attr2="false")") );
+ ContainsSubstring(R"(attr1="true")") &&
+ ContainsSubstring(R"(attr2="false")") );
}