diff options
| author | Martin Hořeňovský | 2021-03-25 20:02:47 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-03-26 21:11:44 +0100 |
| commit | f1d7a10e06f0f26d02e86c340d93a482b2c50e17 (patch) | |
| tree | 392c56310e6ff1015b6b4ad29bc9fd3405023795 /tests/SelfTest/Baselines | |
| parent | e50e10ef8f06dbeac8f92daffc9344bb7621daf1 (diff) | |
| download | catch3-f1d7a10e06f0f26d02e86c340d93a482b2c50e17.tar.gz | |
Remove StringRef::isNullTerminated and StringRef::c_str
Both of them were fundamentally unsafe to use and shouldn't be used
at all.
Diffstat (limited to 'tests/SelfTest/Baselines')
| -rw-r--r-- | tests/SelfTest/Baselines/compact.sw.approved.txt | 17 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/console.std.approved.txt | 2 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/console.sw.approved.txt | 54 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/junit.sw.approved.txt | 2 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/tap.sw.approved.txt | 30 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/xml.sw.approved.txt | 68 |
6 files changed, 23 insertions, 150 deletions
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 3b19a962..e757222d 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1481,29 +1481,23 @@ Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith("sub Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) String.tests.cpp:<line number>: passed: empty.empty() for: true String.tests.cpp:<line number>: passed: empty.size() == 0 for: 0 == 0 -String.tests.cpp:<line number>: passed: empty.isNullTerminated() for: true -String.tests.cpp:<line number>: passed: std::strcmp( empty.c_str(), "" ) == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: std::strcmp( empty.data(), "" ) == 0 for: 0 == 0 String.tests.cpp:<line number>: passed: s.empty() == false for: false == false String.tests.cpp:<line number>: passed: s.size() == 5 for: 5 == 5 -String.tests.cpp:<line number>: passed: s.isNullTerminated() for: true String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0 -String.tests.cpp:<line number>: passed: s.c_str() -String.tests.cpp:<line number>: passed: s.c_str() == rawChars for: "hello" == "hello" String.tests.cpp:<line number>: passed: s.data() == rawChars for: "hello" == "hello" String.tests.cpp:<line number>: passed: original == "original" -String.tests.cpp:<line number>: passed: !(original.isNullTerminated()) for: !false -String.tests.cpp:<line number>: passed: original.c_str() String.tests.cpp:<line number>: passed: original.data() String.tests.cpp:<line number>: passed: ss.empty() == false for: false == false String.tests.cpp:<line number>: passed: ss.size() == 5 for: 5 == 5 String.tests.cpp:<line number>: passed: std::strncmp( ss.data(), "hello", 5 ) == 0 for: 0 == 0 String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello" String.tests.cpp:<line number>: passed: ss.size() == 6 for: 6 == 6 -String.tests.cpp:<line number>: passed: std::strcmp( ss.c_str(), "world!" ) == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: std::strcmp( ss.data(), "world!" ) == 0 for: 0 == 0 String.tests.cpp:<line number>: passed: s.data() == s2.data() for: "hello world!" == "hello world!" String.tests.cpp:<line number>: passed: s.data() == ss.data() for: "hello world!" == "hello world!" String.tests.cpp:<line number>: passed: s.substr(s.size() + 1, 123).empty() for: true -String.tests.cpp:<line number>: passed: std::strcmp(ss.c_str(), "world!") == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: std::strcmp(ss.data(), "world!") == 0 for: 0 == 0 String.tests.cpp:<line number>: passed: s.substr(1'000'000, 1).empty() for: true String.tests.cpp:<line number>: passed: reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) for: "Hello" != "Hello" String.tests.cpp:<line number>: passed: left == right for: Hello == Hello @@ -1525,7 +1519,6 @@ String.tests.cpp:<line number>: passed: together == "abrakadabra" for: "abrakada String.tests.cpp:<line number>: passed: with 1 message: 'empty.size() == 0' String.tests.cpp:<line number>: passed: with 1 message: 'empty.begin() == empty.end()' String.tests.cpp:<line number>: passed: with 1 message: 'stringref.size() == 3' -String.tests.cpp:<line number>: passed: with 1 message: 'stringref.isNullTerminated()' String.tests.cpp:<line number>: passed: with 1 message: 'stringref.data() == abc' String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() == abc' String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() != stringref.end()' @@ -1535,14 +1528,10 @@ 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()' -String.tests.cpp:<line number>: passed: with 1 message: '!(shortened.isNullTerminated())' -String.tests.cpp:<line number>: passed: with 1 message: '!(shortened.substr(1, 3).isNullTerminated())' String.tests.cpp:<line number>: passed: with 1 message: '!(sr1.empty())' String.tests.cpp:<line number>: passed: with 1 message: 'sr1.size() == 3' -String.tests.cpp:<line number>: passed: with 1 message: 'sr1.isNullTerminated()' String.tests.cpp:<line number>: passed: with 1 message: 'sr2.empty()' String.tests.cpp:<line number>: passed: with 1 message: 'sr2.size() == 0' -String.tests.cpp:<line number>: passed: with 1 message: 'sr2.isNullTerminated()' ToStringChrono.tests.cpp:<line number>: passed: minute == seconds for: 1 m == 60 s ToStringChrono.tests.cpp:<line number>: passed: hour != seconds for: 1 h != 60 s ToStringChrono.tests.cpp:<line number>: passed: micro != milli for: 1 us != 1 ms diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index d781a60e..f91f4b80 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1381,5 +1381,5 @@ due to unexpected exception with message: =============================================================================== test cases: 356 | 282 passed | 70 failed | 4 failed as expected -assertions: 2088 | 1936 passed | 131 failed | 21 failed as expected +assertions: 2077 | 1925 passed | 131 failed | 21 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 7066d593..5f77647a 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -10494,12 +10494,7 @@ with expansion: 0 == 0 String.tests.cpp:<line number>: PASSED: - REQUIRE( empty.isNullTerminated() ) -with expansion: - true - -String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 ) + REQUIRE( std::strcmp( empty.data(), "" ) == 0 ) with expansion: 0 == 0 @@ -10521,24 +10516,11 @@ with expansion: 5 == 5 String.tests.cpp:<line number>: PASSED: - REQUIRE( s.isNullTerminated() ) -with expansion: - true - -String.tests.cpp:<line number>: PASSED: REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ) with expansion: 0 == 0 String.tests.cpp:<line number>: PASSED: - REQUIRE_NOTHROW( s.c_str() ) - -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.c_str() == rawChars ) -with expansion: - "hello" == "hello" - -String.tests.cpp:<line number>: PASSED: REQUIRE( s.data() == rawChars ) with expansion: "hello" == "hello" @@ -10554,14 +10536,6 @@ String.tests.cpp:<line number>: PASSED: REQUIRE( original == "original" ) String.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( original.isNullTerminated() ) -with expansion: - !false - -String.tests.cpp:<line number>: PASSED: - REQUIRE_THROWS( original.c_str() ) - -String.tests.cpp:<line number>: PASSED: REQUIRE_NOTHROW( original.data() ) ------------------------------------------------------------------------------- @@ -10606,7 +10580,7 @@ with expansion: 6 == 6 String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( ss.c_str(), "world!" ) == 0 ) + REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 ) with expansion: 0 == 0 @@ -10658,7 +10632,7 @@ String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp(ss.c_str(), "world!") == 0 ) + REQUIRE( std::strcmp(ss.data(), "world!") == 0 ) with expansion: 0 == 0 @@ -10834,10 +10808,6 @@ with message: String.tests.cpp:<line number>: PASSED: with message: - stringref.isNullTerminated() - -String.tests.cpp:<line number>: PASSED: -with message: stringref.data() == abc String.tests.cpp:<line number>: PASSED: @@ -10872,14 +10842,6 @@ String.tests.cpp:<line number>: PASSED: with message: shortened.begin() != shortened.end() -String.tests.cpp:<line number>: PASSED: -with message: - !(shortened.isNullTerminated()) - -String.tests.cpp:<line number>: PASSED: -with message: - !(shortened.substr(1, 3).isNullTerminated()) - ------------------------------------------------------------------------------- StringRef at compilation time UDL construction @@ -10897,20 +10859,12 @@ with message: String.tests.cpp:<line number>: PASSED: with message: - sr1.isNullTerminated() - -String.tests.cpp:<line number>: PASSED: -with message: sr2.empty() String.tests.cpp:<line number>: PASSED: with message: sr2.size() == 0 -String.tests.cpp:<line number>: PASSED: -with message: - sr2.isNullTerminated() - ------------------------------------------------------------------------------- Stringifying std::chrono::duration helpers ------------------------------------------------------------------------------- @@ -16769,5 +16723,5 @@ Misc.tests.cpp:<line number>: PASSED: =============================================================================== test cases: 356 | 266 passed | 86 failed | 4 failed as expected -assertions: 2105 | 1936 passed | 148 failed | 21 failed as expected +assertions: 2094 | 1925 passed | 148 failed | 21 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 5206ed2d..12a1456f 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="132" tests="2106" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="132" tests="2095" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> <property name="random-seed" value="1"/> diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index edf6d1ed..8bb648f5 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -2646,30 +2646,18 @@ ok {test-number} - empty.empty() for: true # StringRef ok {test-number} - empty.size() == 0 for: 0 == 0 # StringRef -ok {test-number} - empty.isNullTerminated() for: true -# StringRef -ok {test-number} - std::strcmp( empty.c_str(), "" ) == 0 for: 0 == 0 +ok {test-number} - std::strcmp( empty.data(), "" ) == 0 for: 0 == 0 # StringRef ok {test-number} - s.empty() == false for: false == false # StringRef ok {test-number} - s.size() == 5 for: 5 == 5 # StringRef -ok {test-number} - s.isNullTerminated() for: true -# StringRef ok {test-number} - std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0 # StringRef -ok {test-number} - s.c_str() -# StringRef -ok {test-number} - s.c_str() == rawChars for: "hello" == "hello" -# StringRef ok {test-number} - s.data() == rawChars for: "hello" == "hello" # StringRef ok {test-number} - original == "original" # StringRef -ok {test-number} - !(original.isNullTerminated()) for: !false -# StringRef -ok {test-number} - original.c_str() -# StringRef ok {test-number} - original.data() # StringRef ok {test-number} - ss.empty() == false for: false == false @@ -2682,7 +2670,7 @@ ok {test-number} - ss == "hello" for: hello == "hello" # StringRef ok {test-number} - ss.size() == 6 for: 6 == 6 # StringRef -ok {test-number} - std::strcmp( ss.c_str(), "world!" ) == 0 for: 0 == 0 +ok {test-number} - std::strcmp( ss.data(), "world!" ) == 0 for: 0 == 0 # StringRef ok {test-number} - s.data() == s2.data() for: "hello world!" == "hello world!" # StringRef @@ -2690,7 +2678,7 @@ ok {test-number} - s.data() == ss.data() for: "hello world!" == "hello world!" # StringRef ok {test-number} - s.substr(s.size() + 1, 123).empty() for: true # StringRef -ok {test-number} - std::strcmp(ss.c_str(), "world!") == 0 for: 0 == 0 +ok {test-number} - std::strcmp(ss.data(), "world!") == 0 for: 0 == 0 # StringRef ok {test-number} - s.substr(1'000'000, 1).empty() for: true # StringRef @@ -2730,8 +2718,6 @@ ok {test-number} - with 1 message: 'empty.begin() == empty.end()' # StringRef at compilation time ok {test-number} - with 1 message: 'stringref.size() == 3' # StringRef at compilation time -ok {test-number} - with 1 message: 'stringref.isNullTerminated()' -# StringRef at compilation time ok {test-number} - with 1 message: 'stringref.data() == abc' # StringRef at compilation time ok {test-number} - with 1 message: 'stringref.begin() == abc' @@ -2750,21 +2736,13 @@ ok {test-number} - with 1 message: 'shortened.data() == abc' # StringRef at compilation time ok {test-number} - with 1 message: 'shortened.begin() != shortened.end()' # StringRef at compilation time -ok {test-number} - with 1 message: '!(shortened.isNullTerminated())' -# StringRef at compilation time -ok {test-number} - with 1 message: '!(shortened.substr(1, 3).isNullTerminated())' -# StringRef at compilation time ok {test-number} - with 1 message: '!(sr1.empty())' # StringRef at compilation time ok {test-number} - with 1 message: 'sr1.size() == 3' # StringRef at compilation time -ok {test-number} - with 1 message: 'sr1.isNullTerminated()' -# StringRef at compilation time ok {test-number} - with 1 message: 'sr2.empty()' # StringRef at compilation time ok {test-number} - with 1 message: 'sr2.size() == 0' -# StringRef at compilation time -ok {test-number} - with 1 message: 'sr2.isNullTerminated()' # Stringifying std::chrono::duration helpers ok {test-number} - minute == seconds for: 1 m == 60 s # Stringifying std::chrono::duration helpers @@ -4202,5 +4180,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2105 +1..2094 diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index ceaa32bc..a624d5bd 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -12536,21 +12536,13 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - empty.isNullTerminated() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <Original> - std::strcmp( empty.c_str(), "" ) == 0 + std::strcmp( empty.data(), "" ) == 0 </Original> <Expanded> 0 == 0 </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0"/> </Section> <Section name="From string literal" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -12571,36 +12563,12 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - s.isNullTerminated() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <Original> std::strcmp( rawChars, "hello" ) == 0 </Original> <Expanded> 0 == 0 </Expanded> </Expression> - <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <Original> - s.c_str() - </Original> - <Expanded> - s.c_str() - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <Original> - s.c_str() == rawChars - </Original> - <Expanded> - "hello" == "hello" - </Expanded> - </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> s.data() == rawChars @@ -12609,7 +12577,7 @@ Message from section two "hello" == "hello" </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0"/> </Section> <Section name="From sub-string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -12620,22 +12588,6 @@ Message from section two original == "original" </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <Original> - !(original.isNullTerminated()) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <Original> - original.c_str() - </Original> - <Expanded> - original.c_str() - </Expanded> - </Expression> <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> original.data() @@ -12644,7 +12596,7 @@ Message from section two original.data() </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -12696,7 +12648,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - std::strcmp( ss.c_str(), "world!" ) == 0 + std::strcmp( ss.data(), "world!" ) == 0 </Original> <Expanded> 0 == 0 @@ -12752,7 +12704,7 @@ Message from section two <Section name="Substring off the end are trimmed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - std::strcmp(ss.c_str(), "world!") == 0 + std::strcmp(ss.data(), "world!") == 0 </Original> <Expanded> 0 == 0 @@ -12941,10 +12893,10 @@ 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="15" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0"/> </Section> <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0"/> </Section> <OverallResult success="true"/> </TestCase> @@ -19715,9 +19667,9 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="1936" failures="149" expectedFailures="21"/> + <OverallResults successes="1925" failures="149" expectedFailures="21"/> <OverallResultsCases successes="266" failures="86" expectedFailures="4"/> </Group> - <OverallResults successes="1936" failures="148" expectedFailures="21"/> + <OverallResults successes="1925" failures="148" expectedFailures="21"/> <OverallResultsCases successes="266" failures="86" expectedFailures="4"/> </Catch> |