Index: libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp =================================================================== --- libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp +++ libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp @@ -38,88 +38,72 @@ struct AppendOperatorTestcase { MultiStringType lhs; MultiStringType rhs; - MultiStringType expect; + MultiStringType expect_posix; + MultiStringType expect_windows; }; -#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")} +#define expect expect_windows #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")} +#define expect expect_posix #endif + +#define S(Str) MKSTR(Str) +const AppendOperatorTestcase Cases[] = + { + {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