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

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/StringRef.tests.cpp
diff options
context:
space:
mode:
authorPhil Nash2017-08-14 09:04:14 +0100
committerPhil Nash2017-08-14 09:04:14 +0100
commit3772f69f0fbba0620df4c262b1925444a0567b37 (patch)
tree684dfe257d34c22ff48826ffc7572f14aecb145e /projects/SelfTest/StringRef.tests.cpp
parentece64c3b3aee6256be32f1f860b5d638173e7520 (diff)
downloadcatch3-3772f69f0fbba0620df4c262b1925444a0567b37.tar.gz
Removed String and StringBuilder
Diffstat (limited to 'projects/SelfTest/StringRef.tests.cpp')
-rw-r--r--projects/SelfTest/StringRef.tests.cpp30
1 files changed, 1 insertions, 29 deletions
diff --git a/projects/SelfTest/StringRef.tests.cpp b/projects/SelfTest/StringRef.tests.cpp
index 6ebbdb13..d12c79a3 100644
--- a/projects/SelfTest/StringRef.tests.cpp
+++ b/projects/SelfTest/StringRef.tests.cpp
@@ -1,5 +1,4 @@
#include "../include/internal/catch_stringref.h"
-#include "../include/internal/catch_string.h"
#include "catch.hpp"
@@ -40,8 +39,7 @@ namespace Catch {
TEST_CASE( "StringRef", "[Strings]" ) {
using Catch::StringRef;
- using Catch::String;
-
+
SECTION( "Empty string" ) {
StringRef empty;
REQUIRE( empty.empty() );
@@ -124,32 +122,6 @@ TEST_CASE( "StringRef", "[Strings]" ) {
REQUIRE( StringRef("hello") == StringRef("hello") );
REQUIRE( StringRef("hello") != StringRef("cello") );
}
-
- SECTION( "From string" ) {
- String str = "hot potato";
- auto originalPointer = str.c_str();
-
- SECTION( "Copied" ) {
- // After a String is "copied" to a StringRef
- // It has only copied the pointer and size
- // - it does not take ownership
- StringRef copied = str;
- REQUIRE( copied == "hot potato" );
- REQUIRE( str == "hot potato" );
- REQUIRE( isOwned( copied ) == false );
- REQUIRE( data( copied ) == originalPointer );
- }
- SECTION( "Moved" ) {
- // After a String is *moved* to a StringRef
- // The StringRef takes ownership of the underlying data
- // and the String is left in an empty state
- StringRef copied = std::move( str );
- REQUIRE( copied == "hot potato" );
- REQUIRE( isOwned( copied ) );
- REQUIRE( str.empty() );
- REQUIRE( data( copied ) == originalPointer );
- }
- }
SECTION( "from std::string" ) {
std::string stdStr = "a standard string";