[libcxx-commits] [libcxx] 87d7c00 - [libcxx] [test] Fix path.modifiers/make_preferred for windows
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 20 09:44:31 PDT 2020
Author: Martin Storsjö
Date: 2020-10-20T19:44:21+03:00
New Revision: 87d7c0009265951f988ea551203500ccfa141b15
URL: https://github.com/llvm/llvm-project/commit/87d7c0009265951f988ea551203500ccfa141b15
DIFF: https://github.com/llvm/llvm-project/commit/87d7c0009265951f988ea551203500ccfa141b15.diff
LOG: [libcxx] [test] Fix path.modifiers/make_preferred for windows
Use p.string() instead of p.native() for comparing with the expected
value.
Explicitly list the expected values for both posix and windos, even if
the operation is an identity operation on posix.
Differential Revision: https://reviews.llvm.org/D89532
Added:
Modified:
libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
index e26b5a51392b..da505d6a7d77 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
@@ -26,28 +26,36 @@
struct MakePreferredTestcase {
const char* value;
+ const char* expected_posix;
+ const char* expected_windows;
};
const MakePreferredTestcase TestCases[] =
{
- {""}
- , {"hello_world"}
- , {"/"}
- , {"/foo/bar/baz/"}
- , {"\\"}
- , {"\\foo\\bar\\baz\\"}
- , {"\\foo\\/bar\\/baz\\"}
+ {"", "", ""}
+ , {"hello_world", "hello_world", "hello_world"}
+ , {"/", "/", "\\"}
+ , {"/foo/bar/baz/", "/foo/bar/baz/", "\\foo\\bar\\baz\\"}
+ , {"\\", "\\", "\\"}
+ , {"\\foo\\bar\\baz\\", "\\foo\\bar\\baz\\", "\\foo\\bar\\baz\\"}
+ , {"\\foo\\/bar\\/baz\\", "\\foo\\/bar\\/baz\\", "\\foo\\\\bar\\\\baz\\"}
};
int main(int, char**)
{
// This operation is an identity operation on linux.
+ // On windows, compare with preferred_win, if set.
using namespace fs;
for (auto const & TC : TestCases) {
path p(TC.value);
assert(p == TC.value);
path& Ref = (p.make_preferred());
- assert(p.native() == TC.value);
+#ifdef _WIN32
+ std::string s(TC.expected_windows);
+#else
+ std::string s(TC.expected_posix);
+#endif
+ assert(p.string() == s);
assert(&Ref == &p);
}
More information about the libcxx-commits
mailing list