[libcxx-commits] [PATCH] D98106: [libcxx] [test] Fix lexically_normal and lexically_relative_and_proximate for windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 6 05:27:49 PST 2021


mstorsjo updated this revision to Diff 328758.
mstorsjo added a comment.

Un-ifdef a testcase that was identical in both cases


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98106

Files:
  libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
  libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp


Index: libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
+++ libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
@@ -36,8 +36,13 @@
       {"a", "/", ""},
       {"//net", "a", ""},
       {"a", "//net", ""},
+#ifdef _WIN32
+      {"//net/", "//net", ""},
+      {"//net", "//net/", ""},
+#else
       {"//net/", "//net", "."},
       {"//net", "//net/", "."},
+#endif
       {"//base", "a", ""},
       {"a", "a", "."},
       {"a/b", "a/b", "."},
@@ -59,6 +64,8 @@
     ++ID;
     const fs::path p(TC.input);
     const fs::path output = p.lexically_relative(TC.base);
+    fs::path expect(TC.expect);
+    expect.make_preferred();
     auto ReportErr = [&](const char* Testing, fs::path const& Output,
                                               fs::path const& Expected) {
       Failed = true;
@@ -71,8 +78,8 @@
         ID, Testing, TC.input.c_str(), TC.base.c_str(),
         Expected.string().c_str(), Output.string().c_str());
     };
-    if (!PathEq(output, TC.expect))
-      ReportErr("path::lexically_relative", output, TC.expect);
+    if (!PathEq(output, expect))
+      ReportErr("path::lexically_relative", output, expect);
     const fs::path proximate_output = p.lexically_proximate(TC.base);
     // [path.gen] lexically_proximate
     // Returns: If the value of lexically_relative(base) is not an empty path,
Index: libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
+++ libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
@@ -54,10 +54,17 @@
       {"/a/b/./", "/a/b/"},
       {"/a/b/c/../d", "/a/b/d"},
       {"/a/b/c/../d/", "/a/b/d/"},
+#ifdef _WIN32
+      {"//a/", "//a/"},
+      {"//a/b/", "//a/b/"},
+      {"//a/b/.", "//a/b/"},
+      {"//a/..", "//a/"},
+#else
       {"//a/", "/a/"},
       {"//a/b/", "/a/b/"},
       {"//a/b/.", "/a/b/"},
       {"//a/..", "/"},
+#endif
       ///===---------------------------------------------------------------===//
       /// Tests specifically for the clauses under [fs.path.generic]p6
       ///===---------------------------------------------------------------===//
@@ -125,13 +132,15 @@
     ++ID;
     fs::path p(TC.input);
     const fs::path output = p.lexically_normal();
-    if (!PathEq(output, TC.expect)) {
+    fs::path expect(TC.expect);
+    expect.make_preferred();
+    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.c_str(), TC.expect.c_str(), output.string().c_str());
+        ID, TC.input.c_str(), expect.string().c_str(), output.string().c_str());
     }
   }
   return Failed;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98106.328758.patch
Type: text/x-patch
Size: 3260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210306/2ad0eea3/attachment-0001.bin>


More information about the libcxx-commits mailing list