[libcxx-commits] [libcxx] e23317c - [libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 9 06:59:18 PST 2021
Author: Martin Storsjö
Date: 2021-03-09T16:57:26+02:00
New Revision: e23317c9dae965ebc5534acea0352621740ae1e7
URL: https://github.com/llvm/llvm-project/commit/e23317c9dae965ebc5534acea0352621740ae1e7
DIFF: https://github.com/llvm/llvm-project/commit/e23317c9dae965ebc5534acea0352621740ae1e7.diff
LOG: [libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows
This test was previously tweaked in
321f696920630be1b3c93e2a8b965c624ddd646c 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.
Differential Revision: https://reviews.llvm.org/D98215
Added:
Modified:
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
libcxx/test/support/filesystem_test_helper.h
Removed:
################################################################################
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
index 23c18f1e689d..4b597fc2e982 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
@@ -42,15 +42,16 @@ TEST_CASE(basic_test)
} 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)));
}
}
diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index 259d6767ac08..e12aa9956c0c 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -591,6 +591,12 @@ inline bool PathEq(fs::path const& LHS, fs::path const& RHS) {
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;
More information about the libcxx-commits
mailing list