[libcxx-commits] [PATCH] D89945: [libcxx] [test] Use separate referenes for windows in the path.append test

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 4 07:58:23 PST 2021


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

LGTM if we get rid of the `expect` macro.



================
Comment at: libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp:46
 #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
----------------
Let's use a function for this:

```
MultiStringType const& expected_result(AppendOperatorTestcase const& tc) {
#if defined(_WIN32)
  return tc. expect_windows;
#else
  return tc.expect_posix;
#endif
};
```

Then, use `expected_result(TC)` below instead of `TC.expect`. WDYT? Feel free to make it a member function if you prefer.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89945/new/

https://reviews.llvm.org/D89945



More information about the libcxx-commits mailing list