mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 13:55:39 +02:00
Cleanup and optimize stringifying of string-like types
More specifically, made the actual implementation of string-like type handling take argument as `Catch::StringRef`, instead of taking `std::string const&`. This means that string-like types that are not `std::string` no longer need to pay for an extra construction of `std::string` (including the potential allocation), before they can be stringified. The actual string stringification routine is now also better about reserving sufficient space.
This commit is contained in:
@@ -12900,6 +12900,63 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Stringifying char arrays with statically known sizes - char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s
|
||||
</Original>
|
||||
<Expanded>
|
||||
""abc"" == ""abc""
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s
|
||||
</Original>
|
||||
<Expanded>
|
||||
""abc"" == ""abc""
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Stringifying char arrays with statically known sizes - signed char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s
|
||||
</Original>
|
||||
<Expanded>
|
||||
""abc"" == ""abc""
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s
|
||||
</Original>
|
||||
<Expanded>
|
||||
""abc"" == ""abc""
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Stringifying char arrays with statically known sizes - unsigned char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s
|
||||
</Original>
|
||||
<Expanded>
|
||||
""abc"" == ""abc""
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s
|
||||
</Original>
|
||||
<Expanded>
|
||||
""abc"" == ""abc""
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
|
||||
<Original>
|
||||
@@ -19745,9 +19802,9 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="1932" failures="147" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="268" failures="86" expectedFailures="6"/>
|
||||
<OverallResults successes="1938" failures="147" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="271" failures="86" expectedFailures="6"/>
|
||||
</Group>
|
||||
<OverallResults successes="1932" failures="146" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="268" failures="86" expectedFailures="6"/>
|
||||
<OverallResults successes="1938" failures="146" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="271" failures="86" expectedFailures="6"/>
|
||||
</Catch>
|
||||
|
Reference in New Issue
Block a user