[libcxx-commits] [PATCH] D98643: [libcxx] [test] Fix weakly_canonical for windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 19 07:13:11 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2ec9239a7b1f: [libcxx] [test] Fix weakly_canonical for windows (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D98643?vs=330729&id=331868#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98643/new/

https://reviews.llvm.org/D98643

Files:
  libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp


Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
@@ -27,6 +27,7 @@
 
   static_test_env static_env;
 
+  fs::path root = fs::current_path().root_path();
   // clang-format off
   struct {
     fs::path input;
@@ -34,10 +35,10 @@
   } TestCases[] = {
       {"", fs::current_path()},
       {".", fs::current_path()},
-      {"/", "/"},
-      {"/foo", "/foo"},
-      {"/.", "/"},
-      {"/./", "/"},
+      {"/", root},
+      {"/foo", root / "foo"},
+      {"/.", root},
+      {"/./", root},
       {"a/b", fs::current_path() / "a/b"},
       {"a", fs::current_path() / "a"},
       {"a/b/", fs::current_path() / "a/b/"},
@@ -61,15 +62,17 @@
   bool Failed = false;
   for (auto& TC : TestCases) {
     ++ID;
-    fs::path p(TC.input);
+    fs::path p = TC.input;
+    fs::path expect = TC.expect;
+    expect.make_preferred();
     const fs::path output = fs::weakly_canonical(p);
-    if (!PathEq(output, TC.expect)) {
+    if (!PathEq(output, expect)) {
       Failed = true;
       std::fprintf(stderr, "TEST CASE #%d FAILED:\n"
                   "  Input: '%s'\n"
                   "  Expected: '%s'\n"
                   "  Output: '%s'\n",
-        ID, TC.input.string().c_str(), TC.expect.string().c_str(),
+        ID, TC.input.string().c_str(), expect.string().c_str(),
         output.string().c_str());
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98643.331868.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210319/2818ee40/attachment-0001.bin>


More information about the libcxx-commits mailing list