[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 13:14:48 PST 2021

mstorsjo created this revision.
mstorsjo added a reviewer: curdeius.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

This test was previously tweaked in
321f696920630be1b3c93e2a8b965c624ddd646c <https://reviews.llvm.org/rG321f696920630be1b3c93e2a8b965c624ddd646c> to match the output of
of MS STL (except that the MS STL fails on the testcase with an
empty path).

libc++ doesn't produce paths with all normalized separators (and the
spec doesn't mandate it to either).

Tweak the test reference to match exactly what libc++ produces. If
testing with a non-libc++ library, do a relaxed comparison that allows
the separators to differ.

  rG LLVM Github Monorepo



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(PathEq(ret, TC.expect));
+        TEST_CHECK(ret == TC.expect); // Separator agnostic comparison
+        LIBCPP_ONLY(TEST_CHECK(PathEq(ret, TC.expect)));

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98215.329120.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210308/e459dff4/attachment.bin>

More information about the libcxx-commits mailing list