[libcxx-commits] [libcxx] 53d7c63 - [libcxx] [test] Use separate references for windows in the path.append test
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 4 13:21:31 PST 2021
Author: Martin Storsjö
Date: 2021-03-04T23:21:02+02:00
New Revision: 53d7c63657599135be6a651b6d9f5b2e596911b8
URL: https://github.com/llvm/llvm-project/commit/53d7c63657599135be6a651b6d9f5b2e596911b8
DIFF: https://github.com/llvm/llvm-project/commit/53d7c63657599135be6a651b6d9f5b2e596911b8.diff
LOG: [libcxx] [test] Use separate references for windows in the path.append test
Differential Revision: https://reviews.llvm.org/D89945
Added:
Modified:
libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
index ad9d06eb9849..661ebac3749f 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
@@ -38,88 +38,74 @@
struct AppendOperatorTestcase {
MultiStringType lhs;
MultiStringType rhs;
- MultiStringType expect;
+ MultiStringType expect_posix;
+ MultiStringType expect_windows;
+
+ MultiStringType const& expected_result() const {
+#ifdef _WIN32
+ return expect_windows;
+#else
+ return expect_posix;
+#endif
+ }
};
#define S(Str) MKSTR(Str)
const AppendOperatorTestcase Cases[] =
{
- {S(""), S(""), S("")}
- , {S("p1"), S("p2"), S("p1/p2")}
- , {S("p1/"), S("p2"), S("p1/p2")}
- , {S("p1"), S("/p2"), S("/p2")}
- , {S("p1/"), S("/p2"), S("/p2")}
- , {S("p1"), S("\\p2"), S("p1/\\p2")}
- , {S("p1\\"), S("p2"), S("p1\\/p2")}
- , {S("p1\\"), S("\\p2"), S("p1\\/\\p2")}
- , {S(""), S("p2"), S("p2")}
- , {S("/p1"), S("p2"), S("/p1/p2")}
- , {S("/p1"), S("/p2"), S("/p2")}
- , {S("/p1/p3"), S("p2"), S("/p1/p3/p2")}
- , {S("/p1/p3/"), S("p2"), S("/p1/p3/p2")}
- , {S("/p1/"), S("p2"), S("/p1/p2")}
- , {S("/p1/p3/"), S("/p2/p4"), S("/p2/p4")}
- , {S("/"), S(""), S("/")}
- , {S("/p1"), S("/p2/"), S("/p2/")}
- , {S("p1"), S(""), S("p1/")}
- , {S("p1/"), S(""), S("p1/")}
-
- , {S("//host"), S("foo"), S("//host/foo")}
- , {S("//host/"), S("foo"), S("//host/foo")}
- , {S("//host"), S(""), S("//host/")}
-
-#ifdef _WIN32
- , {S("foo"), S("C:/bar"), S("C:/bar")}
- , {S("foo"), S("C:"), S("C:")}
-
- , {S("C:"), S(""), S("C:")}
- , {S("C:foo"), S("/bar"), S("C:/bar")}
- , {S("C:foo"), S("bar"), S("C:foo/bar")}
- , {S("C:/foo"), S("bar"), S("C:/foo/bar")}
- , {S("C:/foo"), S("/bar"), S("C:/bar")}
-
- , {S("C:foo"), S("C:/bar"), S("C:/bar")}
- , {S("C:foo"), S("C:bar"), S("C:foo/bar")}
- , {S("C:/foo"), S("C:/bar"), S("C:/bar")}
- , {S("C:/foo"), S("C:bar"), S("C:/foo/bar")}
-
- , {S("C:foo"), S("c:/bar"), S("c:/bar")}
- , {S("C:foo"), S("c:bar"), S("c:bar")}
- , {S("C:/foo"), S("c:/bar"), S("c:/bar")}
- , {S("C:/foo"), S("c:bar"), S("c:bar")}
-
- , {S("C:/foo"), S("D:bar"), S("D:bar")}
-#else
- , {S("foo"), S("C:/bar"), S("foo/C:/bar")}
- , {S("foo"), S("C:"), S("foo/C:")}
-
- , {S("C:"), S(""), S("C:/")}
- , {S("C:foo"), S("/bar"), S("/bar")}
- , {S("C:foo"), S("bar"), S("C:foo/bar")}
- , {S("C:/foo"), S("bar"), S("C:/foo/bar")}
- , {S("C:/foo"), S("/bar"), S("/bar")}
-
- , {S("C:foo"), S("C:/bar"), S("C:foo/C:/bar")}
- , {S("C:foo"), S("C:bar"), S("C:foo/C:bar")}
- , {S("C:/foo"), S("C:/bar"), S("C:/foo/C:/bar")}
- , {S("C:/foo"), S("C:bar"), S("C:/foo/C:bar")}
-
- , {S("C:foo"), S("c:/bar"), S("C:foo/c:/bar")}
- , {S("C:foo"), S("c:bar"), S("C:foo/c:bar")}
- , {S("C:/foo"), S("c:/bar"), S("C:/foo/c:/bar")}
- , {S("C:/foo"), S("c:bar"), S("C:/foo/c:bar")}
-
- , {S("C:/foo"), S("D:bar"), S("C:/foo/D:bar")}
-#endif
+ {S(""), S(""), S(""), S("")}
+ , {S("p1"), S("p2"), S("p1/p2"), S("p1\\p2")}
+ , {S("p1/"), S("p2"), S("p1/p2"), S("p1/p2")}
+ , {S("p1"), S("/p2"), S("/p2"), S("/p2")}
+ , {S("p1/"), S("/p2"), S("/p2"), S("/p2")}
+ , {S("p1"), S("\\p2"), S("p1/\\p2"), S("\\p2")}
+ , {S("p1\\"), S("p2"), S("p1\\/p2"), S("p1\\p2")}
+ , {S("p1\\"), S("\\p2"), S("p1\\/\\p2"), S("\\p2")}
+ , {S(""), S("p2"), S("p2"), S("p2")}
+ , {S("/p1"), S("p2"), S("/p1/p2"), S("/p1\\p2")}
+ , {S("/p1"), S("/p2"), S("/p2"), S("/p2")}
+ , {S("/p1/p3"), S("p2"), S("/p1/p3/p2"), S("/p1/p3\\p2")}
+ , {S("/p1/p3/"), S("p2"), S("/p1/p3/p2"), S("/p1/p3/p2")}
+ , {S("/p1/"), S("p2"), S("/p1/p2"), S("/p1/p2")}
+ , {S("/p1/p3/"), S("/p2/p4"), S("/p2/p4"), S("/p2/p4")}
+ , {S("/"), S(""), S("/"), S("/")}
+ , {S("/p1"), S("/p2/"), S("/p2/"), S("/p2/")}
+ , {S("p1"), S(""), S("p1/"), S("p1\\")}
+ , {S("p1/"), S(""), S("p1/"), S("p1/")}
+
+ , {S("//host"), S("foo"), S("//host/foo"), S("//host\\foo")}
+ , {S("//host/"), S("foo"), S("//host/foo"), S("//host/foo")}
+ , {S("//host"), S(""), S("//host/"), S("//host\\")}
+
+ , {S("foo"), S("C:/bar"), S("foo/C:/bar"), S("C:/bar")}
+ , {S("foo"), S("C:"), S("foo/C:"), S("C:")}
+
+ , {S("C:"), S(""), S("C:/"), S("C:")}
+ , {S("C:foo"), S("/bar"), S("/bar"), S("C:/bar")}
+ , {S("C:foo"), S("bar"), S("C:foo/bar"), S("C:foo\\bar")}
+ , {S("C:/foo"), S("bar"), S("C:/foo/bar"), S("C:/foo\\bar")}
+ , {S("C:/foo"), S("/bar"), S("/bar"), S("C:/bar")}
+
+ , {S("C:foo"), S("C:/bar"), S("C:foo/C:/bar"), S("C:/bar")}
+ , {S("C:foo"), S("C:bar"), S("C:foo/C:bar"), S("C:foo\\bar")}
+ , {S("C:/foo"), S("C:/bar"), S("C:/foo/C:/bar"), S("C:/bar")}
+ , {S("C:/foo"), S("C:bar"), S("C:/foo/C:bar"), S("C:/foo\\bar")}
+
+ , {S("C:foo"), S("c:/bar"), S("C:foo/c:/bar"), S("c:/bar")}
+ , {S("C:foo"), S("c:bar"), S("C:foo/c:bar"), S("c:bar")}
+ , {S("C:/foo"), S("c:/bar"), S("C:/foo/c:/bar"), S("c:/bar")}
+ , {S("C:/foo"), S("c:bar"), S("C:/foo/c:bar"), S("c:bar")}
+
+ , {S("C:/foo"), S("D:bar"), S("C:/foo/D:bar"), S("D:bar")}
};
const AppendOperatorTestcase LongLHSCases[] =
{
- {S("p1"), S("p2"), S("p1/p2")}
- , {S("p1/"), S("p2"), S("p1/p2")}
- , {S("p1"), S("/p2"), S("/p2")}
- , {S("/p1"), S("p2"), S("/p1/p2")}
+ {S("p1"), S("p2"), S("p1/p2"), S("p1\\p2")}
+ , {S("p1/"), S("p2"), S("p1/p2"), S("p1/p2")}
+ , {S("p1"), S("/p2"), S("/p2"), S("/p2")}
+ , {S("/p1"), S("p2"), S("/p1/p2"), S("/p1\\p2")}
};
#undef S
@@ -142,7 +128,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
const Ptr L = TC.lhs;
Str RShort = (Ptr)TC.rhs;
- Str EShort = (Ptr)TC.expect;
+ Str EShort = (Ptr)TC.expected_result();
assert(RShort.size() >= 2);
CharT c = RShort.back();
RShort.append(100, c);
@@ -228,7 +214,7 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
const Ptr R = TC.rhs;
- const Ptr E = TC.expect;
+ const Ptr E = TC.expected_result();
// basic_string
{
path Result(L);
@@ -369,7 +355,7 @@ int main(int, char**)
path LHS(LHS_In);
path RHS(RHS_In);
path& Res = (LHS /= RHS);
- assert(PathEq(Res, (const char*)TC.expect));
+ assert(PathEq(Res, (const char*)TC.expected_result()));
assert(&Res == &LHS);
}
doAppendSourceTest<char> (TC);
More information about the libcxx-commits
mailing list