[libcxx-commits] [libcxx] 74c883f - [libcxx] [test] Use the native path types in path.compare
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 1 11:01:54 PST 2021
Author: Martin Storsjö
Date: 2021-03-01T21:01:46+02:00
New Revision: 74c883f7e5ba9143e51c2a68203e324511eb63a0
URL: https://github.com/llvm/llvm-project/commit/74c883f7e5ba9143e51c2a68203e324511eb63a0
DIFF: https://github.com/llvm/llvm-project/commit/74c883f7e5ba9143e51c2a68203e324511eb63a0.diff
LOG: [libcxx] [test] Use the native path types in path.compare
This makes sure that it actually tests the right compare() overloads
in windows configurations.
This also fixes the allocation guards that enforce no allocations
while running the compare() functions.
Differential Revision: https://reviews.llvm.org/D97551
Added:
Modified:
libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
index cb579637a27b..975e96c3031c 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
@@ -85,8 +85,10 @@ void test_compare_basic()
for (auto const & TC : CompareTestCases) {
const path p1(TC.LHS);
const path p2(TC.RHS);
- const std::string R(TC.RHS);
- const std::string_view RV(TC.RHS);
+ std::string RHS(TC.RHS);
+ const path::string_type R(RHS.begin(), RHS.end());
+ const std::basic_string_view<path::value_type> RV(R);
+ const path::value_type *Ptr = R.c_str();
const int E = TC.expect;
{ // compare(...) functions
DisableAllocationGuard g; // none of these operations should allocate
@@ -94,7 +96,7 @@ void test_compare_basic()
// check runtime results
int ret1 = normalize_ret(p1.compare(p2));
int ret2 = normalize_ret(p1.compare(R));
- int ret3 = normalize_ret(p1.compare(TC.RHS));
+ int ret3 = normalize_ret(p1.compare(Ptr));
int ret4 = normalize_ret(p1.compare(RV));
g.release();
More information about the libcxx-commits
mailing list