diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
@@ -66,6 +66,17 @@
const path p = static_env.DNE;
TEST_CHECK(exists(p) == false);
+ TEST_CHECK(exists(static_env.Dir) == true);
+ TEST_CHECK(exists(static_env.Dir / "dne") == false);
+ // Whether
/dne/.. is considered to exist or not is not necessarily
+ // something we need to define, but the platform specific behaviour
+ // does affect a few other tests, so clarify the root cause here.
+#ifdef _WIN32
+ TEST_CHECK(exists(static_env.Dir / "dne" / "..") == true);
+#else
+ TEST_CHECK(exists(static_env.Dir / "dne" / "..") == false);
+#endif
+
std::error_code ec = GetTestEC();
TEST_CHECK(exists(p, ec) == false);
TEST_CHECK(!ec);
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
@@ -95,7 +95,17 @@
static_test_env static_env;
fs::path p(static_env.SymlinkToDir / "dir2/../dir2/DNE/..");
const fs::path output = fs::weakly_canonical(p);
+ // weakly_canonical has a quirk - if the path is considered to exist,
+ // it's returned without a trailing slash, otherwise it's returned with
+ // one (see a note in fs.op.weakly_canonical/weakly_canonical.pass.cpp).
+ // On Windows, a path like existent/nonexistentsubdir/.. is considered
+ // to exist, on posix it's considered to not exist. Therefore, the
+ // result here differs in the trailing slash.
+#ifdef _WIN32
+ TEST_CHECK(output == fs::path::string_type(static_env.Dir2));
+#else
TEST_CHECK(output == fs::path::string_type(static_env.Dir2 / ""));
+#endif
}
TEST_CASE(test_signature_10) {
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
@@ -46,12 +46,20 @@
{static_env.Dir, static_env.Dir},
{static_env.SymlinkToDir, static_env.Dir},
{static_env.SymlinkToDir / "dir2/.", static_env.Dir / "dir2"},
- // FIXME? If the trailing separator occurs in a part of the path that exists,
+ // Note: If the trailing separator occurs in a part of the path that exists,
// it is omitted. Otherwise it is added to the end of the result.
+ // MS STL and libstdc++ behave similarly.
{static_env.SymlinkToDir / "dir2/./", static_env.Dir / "dir2"},
{static_env.SymlinkToDir / "dir2/DNE/./", static_env.Dir / "dir2/DNE/"},
{static_env.SymlinkToDir / "dir2", static_env.Dir2},
+#ifdef _WIN32
+ // On Windows, this path is considered to exist (even though it
+ // passes through a nonexistent directory), and thus is returned
+ // without a trailing slash, see the note above.
+ {static_env.SymlinkToDir / "dir2/../dir2/DNE/..", static_env.Dir2},
+#else
{static_env.SymlinkToDir / "dir2/../dir2/DNE/..", static_env.Dir2 / ""},
+#endif
{static_env.SymlinkToDir / "dir2/dir3/../DNE/DNE2", static_env.Dir2 / "DNE/DNE2"},
{static_env.Dir / "../dir1", static_env.Dir},
{static_env.Dir / "./.", static_env.Dir},