Split out the rest of string manipulation tests

This commit is contained in:
Martin Hořeňovský 2019-09-07 20:22:36 +02:00
parent fe967b1f41
commit 6da00c1b64
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
5 changed files with 131 additions and 133 deletions

View File

@ -1522,26 +1522,26 @@ Message.tests.cpp:<line number>: passed: true
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "b", "z" ) for: true
String.tests.cpp:<line number>: passed: letters == "azcdefcg" for: "azcdefcg" == "azcdefcg"
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "c", "z" ) for: true
String.tests.cpp:<line number>: passed: letters == "abzdefzg" for: "abzdefzg" == "abzdefzg"
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "a", "z" ) for: true
String.tests.cpp:<line number>: passed: letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg"
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "g", "z" ) for: true
String.tests.cpp:<line number>: passed: letters == "abcdefcz" for: "abcdefcz" == "abcdefcz"
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, letters, "replaced" ) for: true
String.tests.cpp:<line number>: passed: letters == "replaced" for: "replaced" == "replaced"
String.tests.cpp:<line number>: passed: !(Catch::replaceInPlace( letters, "x", "z" )) for: !false
String.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( s, "'", "|'" ) for: true
String.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "b", "z") for: true
StringManip.tests.cpp:<line number>: passed: letters == "azcdefcg" for: "azcdefcg" == "azcdefcg"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "c", "z") for: true
StringManip.tests.cpp:<line number>: passed: letters == "abzdefzg" for: "abzdefzg" == "abzdefzg"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "a", "z") for: true
StringManip.tests.cpp:<line number>: passed: letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "g", "z") for: true
StringManip.tests.cpp:<line number>: passed: letters == "abcdefcz" for: "abcdefcz" == "abcdefcz"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, letters, "replaced") for: true
StringManip.tests.cpp:<line number>: passed: letters == "replaced" for: "replaced" == "replaced"
StringManip.tests.cpp:<line number>: passed: !(Catch::replaceInPlace(letters, "x", "z")) for: !false
StringManip.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'") for: true
StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
Tag.tests.cpp:<line number>: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." )
String.tests.cpp:<line number>: passed: splitStringRef("", ',' ), Equals(std::vector<StringRef>() ) for: { } Equals: { }
String.tests.cpp:<line number>: passed: splitStringRef("abc", ',' ), Equals(std::vector<StringRef>{"abc"} ) for: { abc } Equals: { abc }
String.tests.cpp:<line number>: passed: splitStringRef("abc,def", ',' ), Equals(std::vector<StringRef>{"abc", "def"} ) for: { abc, def } Equals: { abc, def }
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc }
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3'
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6'
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"

View File

@ -11441,15 +11441,15 @@ with expansion:
replaceInPlace
replace single char
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace( letters, "b", "z" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace(letters, "b", "z") )
with expansion:
true
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( letters == "azcdefcg" )
with expansion:
"azcdefcg" == "azcdefcg"
@ -11458,15 +11458,15 @@ with expansion:
replaceInPlace
replace two chars
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace( letters, "c", "z" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace(letters, "c", "z") )
with expansion:
true
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( letters == "abzdefzg" )
with expansion:
"abzdefzg" == "abzdefzg"
@ -11475,15 +11475,15 @@ with expansion:
replaceInPlace
replace first char
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace( letters, "a", "z" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace(letters, "a", "z") )
with expansion:
true
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( letters == "zbcdefcg" )
with expansion:
"zbcdefcg" == "zbcdefcg"
@ -11492,15 +11492,15 @@ with expansion:
replaceInPlace
replace last char
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace( letters, "g", "z" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace(letters, "g", "z") )
with expansion:
true
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( letters == "abcdefcz" )
with expansion:
"abcdefcz" == "abcdefcz"
@ -11509,15 +11509,15 @@ with expansion:
replaceInPlace
replace all chars
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace( letters, letters, "replaced" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace(letters, letters, "replaced") )
with expansion:
true
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( letters == "replaced" )
with expansion:
"replaced" == "replaced"
@ -11526,15 +11526,15 @@ with expansion:
replaceInPlace
replace no chars
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK_FALSE( Catch::replaceInPlace( letters, "x", "z" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK_FALSE( Catch::replaceInPlace(letters, "x", "z") )
with expansion:
!false
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( letters == letters )
with expansion:
"abcdefcg" == "abcdefcg"
@ -11543,15 +11543,15 @@ with expansion:
replaceInPlace
escape '
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace( s, "'", "|'" ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK( Catch::replaceInPlace(s, "'", "|'") )
with expansion:
true
String.tests.cpp:<line number>: PASSED:
StringManip.tests.cpp:<line number>: PASSED:
CHECK( s == "didn|'t" )
with expansion:
"didn|'t" == "didn|'t"
@ -11602,21 +11602,21 @@ with expansion:
-------------------------------------------------------------------------------
splitString
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
StringManip.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
CHECK_THAT( splitStringRef("", ',' ), Equals(std::vector<StringRef>() ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK_THAT( splitStringRef("", ','), Equals(std::vector<StringRef>()) )
with expansion:
{ } Equals: { }
String.tests.cpp:<line number>: PASSED:
CHECK_THAT( splitStringRef("abc", ',' ), Equals(std::vector<StringRef>{"abc"} ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) )
with expansion:
{ abc } Equals: { abc }
String.tests.cpp:<line number>: PASSED:
CHECK_THAT( splitStringRef("abc,def", ',' ), Equals(std::vector<StringRef>{"abc", "def"} ) )
StringManip.tests.cpp:<line number>: PASSED:
CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) )
with expansion:
{ abc, def } Equals: { abc, def }

View File

@ -13732,17 +13732,17 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="replaceInPlace" tags="[StringManip][Strings]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="replace single char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<TestCase name="replaceInPlace" tags="[string-manip]" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Section name="replace single char" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
Catch::replaceInPlace( letters, "b", "z" )
Catch::replaceInPlace(letters, "b", "z")
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
letters == "azcdefcg"
</Original>
@ -13752,16 +13752,16 @@ loose text artifact
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="replace two chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="replace two chars" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
Catch::replaceInPlace( letters, "c", "z" )
Catch::replaceInPlace(letters, "c", "z")
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
letters == "abzdefzg"
</Original>
@ -13771,16 +13771,16 @@ loose text artifact
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="replace first char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="replace first char" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
Catch::replaceInPlace( letters, "a", "z" )
Catch::replaceInPlace(letters, "a", "z")
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
letters == "zbcdefcg"
</Original>
@ -13790,16 +13790,16 @@ loose text artifact
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="replace last char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="replace last char" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
Catch::replaceInPlace( letters, "g", "z" )
Catch::replaceInPlace(letters, "g", "z")
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
letters == "abcdefcz"
</Original>
@ -13809,16 +13809,16 @@ loose text artifact
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="replace all chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="replace all chars" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
Catch::replaceInPlace( letters, letters, "replaced" )
Catch::replaceInPlace(letters, letters, "replaced")
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
letters == "replaced"
</Original>
@ -13828,16 +13828,16 @@ loose text artifact
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="replace no chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="replace no chars" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
!(Catch::replaceInPlace( letters, "x", "z" ))
!(Catch::replaceInPlace(letters, "x", "z"))
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
letters == letters
</Original>
@ -13847,16 +13847,16 @@ loose text artifact
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="escape '" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="escape '" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
Catch::replaceInPlace( s, "'", "|'" )
Catch::replaceInPlace(s, "'", "|'")
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
s == "didn|'t"
</Original>
@ -13913,26 +13913,26 @@ loose text artifact
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="splitString" tags="[Strings]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<TestCase name="splitString" tags="[string-manip]" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
splitStringRef("", ',' ), Equals(std::vector&lt;StringRef>() )
splitStringRef("", ','), Equals(std::vector&lt;StringRef>())
</Original>
<Expanded>
{ } Equals: { }
</Expanded>
</Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
splitStringRef("abc", ',' ), Equals(std::vector&lt;StringRef>{"abc"} )
splitStringRef("abc", ','), Equals(std::vector&lt;StringRef>{"abc"})
</Original>
<Expanded>
{ abc } Equals: { abc }
</Expanded>
</Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
<Original>
splitStringRef("abc,def", ',' ), Equals(std::vector&lt;StringRef>{"abc", "def"} )
splitStringRef("abc,def", ','), Equals(std::vector&lt;StringRef>{"abc", "def"})
</Original>
<Expanded>
{ abc, def } Equals: { abc, def }

View File

@ -160,48 +160,3 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
}
}
}
TEST_CASE( "replaceInPlace", "[Strings][StringManip]" ) {
std::string letters = "abcdefcg";
SECTION( "replace single char" ) {
CHECK( Catch::replaceInPlace( letters, "b", "z" ) );
CHECK( letters == "azcdefcg" );
}
SECTION( "replace two chars" ) {
CHECK( Catch::replaceInPlace( letters, "c", "z" ) );
CHECK( letters == "abzdefzg" );
}
SECTION( "replace first char" ) {
CHECK( Catch::replaceInPlace( letters, "a", "z" ) );
CHECK( letters == "zbcdefcg" );
}
SECTION( "replace last char" ) {
CHECK( Catch::replaceInPlace( letters, "g", "z" ) );
CHECK( letters == "abcdefcz" );
}
SECTION( "replace all chars" ) {
CHECK( Catch::replaceInPlace( letters, letters, "replaced" ) );
CHECK( letters == "replaced" );
}
SECTION( "replace no chars" ) {
CHECK_FALSE( Catch::replaceInPlace( letters, "x", "z" ) );
CHECK( letters == letters );
}
SECTION( "escape '" ) {
std::string s = "didn't";
CHECK( Catch::replaceInPlace( s, "'", "|'" ) );
CHECK( s == "didn|'t" );
}
}
TEST_CASE( "splitString", "[Strings]" ) {
using namespace Catch::Matchers;
using Catch::splitStringRef;
using Catch::StringRef;
CHECK_THAT( splitStringRef("", ',' ), Equals(std::vector<StringRef>() ) );
CHECK_THAT( splitStringRef("abc", ',' ), Equals(std::vector<StringRef>{"abc"} ) );
CHECK_THAT( splitStringRef("abc,def", ',' ), Equals(std::vector<StringRef>{"abc", "def"} ) );
}

View File

@ -22,3 +22,46 @@ TEST_CASE("Trim strings", "[string-manip]") {
REQUIRE(trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace));
REQUIRE(trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace));
}
TEST_CASE("replaceInPlace", "[string-manip]") {
std::string letters = "abcdefcg";
SECTION("replace single char") {
CHECK(Catch::replaceInPlace(letters, "b", "z"));
CHECK(letters == "azcdefcg");
}
SECTION("replace two chars") {
CHECK(Catch::replaceInPlace(letters, "c", "z"));
CHECK(letters == "abzdefzg");
}
SECTION("replace first char") {
CHECK(Catch::replaceInPlace(letters, "a", "z"));
CHECK(letters == "zbcdefcg");
}
SECTION("replace last char") {
CHECK(Catch::replaceInPlace(letters, "g", "z"));
CHECK(letters == "abcdefcz");
}
SECTION("replace all chars") {
CHECK(Catch::replaceInPlace(letters, letters, "replaced"));
CHECK(letters == "replaced");
}
SECTION("replace no chars") {
CHECK_FALSE(Catch::replaceInPlace(letters, "x", "z"));
CHECK(letters == letters);
}
SECTION("escape '") {
std::string s = "didn't";
CHECK(Catch::replaceInPlace(s, "'", "|'"));
CHECK(s == "didn|'t");
}
}
TEST_CASE("splitString", "[string-manip]") {
using namespace Catch::Matchers;
using Catch::splitStringRef;
using Catch::StringRef;
CHECK_THAT(splitStringRef("", ','), Equals(std::vector<StringRef>()));
CHECK_THAT(splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}));
CHECK_THAT(splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}));
}