Add op+(StringRef, StringRef) -> std::string
This commit is contained in:
parent
f2b9508081
commit
317145514f
10 changed files with 89 additions and 7 deletions
|
@ -4,7 +4,6 @@
|
|||
#include <cstring>
|
||||
|
||||
TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
|
||||
|
||||
using Catch::StringRef;
|
||||
|
||||
SECTION( "Empty string" ) {
|
||||
|
@ -123,6 +122,18 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
|
|||
REQUIRE( stdStr.size() == sr.size() );
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("std::string += StringRef") {
|
||||
StringRef sr = "the stringref contents";
|
||||
std::string lhs("some string += ");
|
||||
lhs += sr;
|
||||
REQUIRE(lhs == "some string += the stringref contents");
|
||||
}
|
||||
SECTION("StringRef + StringRef") {
|
||||
StringRef sr1 = "abraka", sr2 = "dabra";
|
||||
std::string together = sr1 + sr2;
|
||||
REQUIRE(together == "abrakadabra");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue