diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 3e2984f6..fccf52ca 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -1031,6 +1031,7 @@ String.tests.cpp:: passed: ss.size() == 6 for: 6 == 6 String.tests.cpp:: passed: std::strcmp( ss.c_str(), "world!" ) == 0 for: 0 == 0 String.tests.cpp:: passed: s.c_str() == s2.c_str() for: "hello world!" == "hello world!" String.tests.cpp:: passed: s.c_str() != ss.c_str() for: "hello world!" != "hello" +String.tests.cpp:: passed: s.substr(s.size() + 1, 123).empty() for: true String.tests.cpp:: passed: StringRef("hello") == StringRef("hello") for: hello == hello String.tests.cpp:: passed: StringRef("hello") != StringRef("cello") for: hello != cello String.tests.cpp:: passed: sr == "a standard string" for: a standard string == "a standard string" diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 1f30e8f4..a52bb9a5 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1381,5 +1381,5 @@ due to unexpected exception with message: =============================================================================== test cases: 300 | 226 passed | 70 failed | 4 failed as expected -assertions: 1557 | 1405 passed | 131 failed | 21 failed as expected +assertions: 1558 | 1406 passed | 131 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 3bd3a759..1fca8cf3 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -7712,6 +7712,19 @@ String.tests.cpp:: PASSED: with expansion: "hello world!" != "hello" +------------------------------------------------------------------------------- +StringRef + Substrings + Past the end substring +------------------------------------------------------------------------------- +String.tests.cpp: +............................................................................... + +String.tests.cpp:: PASSED: + REQUIRE( s.substr(s.size() + 1, 123).empty() ) +with expansion: + true + ------------------------------------------------------------------------------- StringRef Comparisons @@ -12444,5 +12457,5 @@ Misc.tests.cpp:: PASSED: =============================================================================== test cases: 300 | 210 passed | 86 failed | 4 failed as expected -assertions: 1574 | 1405 passed | 148 failed | 21 failed as expected +assertions: 1575 | 1406 passed | 148 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index c3cf2d6f..ca1998ed 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -722,6 +722,7 @@ Matchers.tests.cpp: + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index de3b7657..c406d061 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -9516,6 +9516,20 @@ Message from section two +
+
+ + + s.substr(s.size() + 1, 123).empty() + + + true + + + +
+ +
@@ -14812,7 +14826,7 @@ loose text artifact
- + - + diff --git a/projects/SelfTest/IntrospectiveTests/String.tests.cpp b/projects/SelfTest/IntrospectiveTests/String.tests.cpp index 77c16dcb..456dd4a7 100644 --- a/projects/SelfTest/IntrospectiveTests/String.tests.cpp +++ b/projects/SelfTest/IntrospectiveTests/String.tests.cpp @@ -111,6 +111,10 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) { SECTION( "Pointer values of substring refs should not match" ) { REQUIRE( s.c_str() != ss.c_str() ); } + + SECTION("Past the end substring") { + REQUIRE(s.substr(s.size() + 1, 123).empty()); + } } SECTION( "Comparisons" ) {