Skip to content

Commit 74c883f

Browse files
committed
[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
1 parent d942a82 commit 74c883f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,18 @@ void test_compare_basic()
8585
for (auto const & TC : CompareTestCases) {
8686
const path p1(TC.LHS);
8787
const path p2(TC.RHS);
88-
const std::string R(TC.RHS);
89-
const std::string_view RV(TC.RHS);
88+
std::string RHS(TC.RHS);
89+
const path::string_type R(RHS.begin(), RHS.end());
90+
const std::basic_string_view<path::value_type> RV(R);
91+
const path::value_type *Ptr = R.c_str();
9092
const int E = TC.expect;
9193
{ // compare(...) functions
9294
DisableAllocationGuard g; // none of these operations should allocate
9395

9496
// check runtime results
9597
int ret1 = normalize_ret(p1.compare(p2));
9698
int ret2 = normalize_ret(p1.compare(R));
97-
int ret3 = normalize_ret(p1.compare(TC.RHS));
99+
int ret3 = normalize_ret(p1.compare(Ptr));
98100
int ret4 = normalize_ret(p1.compare(RV));
99101

100102
g.release();

0 commit comments

Comments
 (0)