diff options
| author | Martin Jeřábek | 2021-03-08 14:57:59 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-12-29 20:20:29 +0100 |
| commit | 8711b63a0a7a64e0b0e65f41971a3a8c27ab7a44 (patch) | |
| tree | fab567daf6e6ab906997e73370bf34fc3f52f8fb /tests/SelfTest/IntrospectiveTests/String.tests.cpp | |
| parent | 72a09de2369b1d48954c2e8aa4c001b46c2e34c0 (diff) | |
| download | catch3-8711b63a0a7a64e0b0e65f41971a3a8c27ab7a44.tar.gz | |
Add tests for StringRef's copy operations being shallow
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/String.tests.cpp')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/String.tests.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/String.tests.cpp b/tests/SelfTest/IntrospectiveTests/String.tests.cpp index 9fd8a780..6245ca77 100644 --- a/tests/SelfTest/IntrospectiveTests/String.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/String.tests.cpp @@ -29,7 +29,17 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) { REQUIRE_NOTHROW(original.data()); } - + SECTION( "Copy construction is shallow" ) { + StringRef original = StringRef( "original string" ); + StringRef copy = original; + REQUIRE(original.begin() == copy.begin()); + } + SECTION( "Copy assignment is shallow" ) { + StringRef original = StringRef( "original string" ); + StringRef copy; + copy = original; + REQUIRE(original.begin() == copy.begin()); + } SECTION( "Substrings" ) { StringRef s = "hello world!"; |