mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Small improvements for StringRef
* `operator[]` is constexpr * `operator<<` and `operator+=` are hidden friends
This commit is contained in:
@@ -1298,6 +1298,7 @@ String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() == ab
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() != stringref.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(10, 0).empty()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(2, 1).data() == abc + 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref[1] == 'b''
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.size() == 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.data() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.begin() != shortened.end()'
|
||||
|
@@ -1381,5 +1381,5 @@ due to unexpected exception with message:
|
||||
|
||||
===============================================================================
|
||||
test cases: 334 | 260 passed | 70 failed | 4 failed as expected
|
||||
assertions: 1895 | 1743 passed | 131 failed | 21 failed as expected
|
||||
assertions: 1896 | 1744 passed | 131 failed | 21 failed as expected
|
||||
|
||||
|
@@ -9492,6 +9492,10 @@ String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.substr(2, 1).data() == abc + 2
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref[1] == 'b'
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.size() == 2
|
||||
@@ -14789,5 +14793,5 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 334 | 244 passed | 86 failed | 4 failed as expected
|
||||
assertions: 1912 | 1743 passed | 148 failed | 21 failed as expected
|
||||
assertions: 1913 | 1744 passed | 148 failed | 21 failed as expected
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1913" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1914" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
|
||||
<property name="random-seed" value="1"/>
|
||||
|
@@ -2510,6 +2510,8 @@ ok {test-number} - with 1 message: 'stringref.substr(10, 0).empty()'
|
||||
# StringRef at compilation time
|
||||
ok {test-number} - with 1 message: 'stringref.substr(2, 1).data() == abc + 2'
|
||||
# StringRef at compilation time
|
||||
ok {test-number} - with 1 message: 'stringref[1] == 'b''
|
||||
# StringRef at compilation time
|
||||
ok {test-number} - with 1 message: 'shortened.size() == 2'
|
||||
# StringRef at compilation time
|
||||
ok {test-number} - with 1 message: 'shortened.data() == abc'
|
||||
@@ -3816,5 +3818,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..1904
|
||||
1..1905
|
||||
|
||||
|
@@ -11728,7 +11728,7 @@ Message from section two
|
||||
</TestCase>
|
||||
<TestCase name="StringRef at compilation time" tags="[constexpr][StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="Simple constructors" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<OverallResults successes="14" failures="0" expectedFailures="0"/>
|
||||
<OverallResults successes="15" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
||||
@@ -17756,7 +17756,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="1743" failures="149" expectedFailures="21"/>
|
||||
<OverallResults successes="1744" failures="149" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="1743" failures="148" expectedFailures="21"/>
|
||||
<OverallResults successes="1744" failures="148" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -126,8 +126,6 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
|
||||
}
|
||||
|
||||
TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") {
|
||||
//TODO:
|
||||
// * substr
|
||||
using Catch::StringRef;
|
||||
SECTION("Simple constructors") {
|
||||
constexpr StringRef empty{};
|
||||
@@ -144,6 +142,7 @@ TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") {
|
||||
STATIC_REQUIRE(stringref.begin() != stringref.end());
|
||||
STATIC_REQUIRE(stringref.substr(10, 0).empty());
|
||||
STATIC_REQUIRE(stringref.substr(2, 1).data() == abc + 2);
|
||||
STATIC_REQUIRE(stringref[1] == 'b');
|
||||
|
||||
|
||||
constexpr StringRef shortened(abc, 2);
|
||||
|
Reference in New Issue
Block a user