[libcxx-commits] [PATCH] D98215: [libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 8 22:06:18 PST 2021


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

Added a helper for doing path equality checks ignoring separator style


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98215

Files:
  libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
  libcxx/test/support/filesystem_test_helper.h


Index: libcxx/test/support/filesystem_test_helper.h
===================================================================
--- libcxx/test/support/filesystem_test_helper.h
+++ libcxx/test/support/filesystem_test_helper.h
@@ -591,6 +591,12 @@
   return LHS.native() == RHS.native();
 }
 
+inline bool PathEqIgnoreSep(fs::path LHS, fs::path RHS) {
+  LHS.make_preferred();
+  RHS.make_preferred();
+  return LHS.native() == RHS.native();
+}
+
 struct ExceptionChecker {
   std::errc expected_err;
   fs::path expected_path1;
Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
@@ -42,15 +42,16 @@
     } TestCases [] = {
         {"", cwd / ""},
         {"foo", cwd / "foo"},
-        {"foo/", cwd / "foo" / ""},
-        {"/already_absolute", cwd.root_path() / "already_absolute"}
+        {"foo/", cwd / "foo/"},
+        {"/already_absolute", cwd.root_name() / "/already_absolute"}
     };
     for (auto& TC : TestCases) {
         std::error_code ec = GetTestEC();
         const path ret = absolute(TC.input, ec);
         TEST_CHECK(!ec);
         TEST_CHECK(ret.is_absolute());
-        TEST_CHECK(PathEq(ret, TC.expect));
+        TEST_CHECK(PathEqIgnoreSep(ret, TC.expect));
+        LIBCPP_ONLY(TEST_CHECK(PathEq(ret, TC.expect)));
     }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98215.329212.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210309/8abb42de/attachment.bin>


More information about the libcxx-commits mailing list