----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/63238/#review189063 -----------------------------------------------------------
3rdparty/stout/tests/path_tests.cpp Lines 40-61 (original), 43-90 (patched) <https://reviews.apache.org/r/63238/#comment265971> Instead of using an `#ifdef` here, we can probably just use `path::join("a", "b")`, as that will join them with the [`os::PATH_SEPARATOR`](https://github.com/apache/mesos/blob/edba292659e05d7a0989eb122f7824e1c21db8fb/3rdparty/stout/include/stout/os/constants.hpp#L26) which is `\` on Windows and `/` elsewhere. 3rdparty/stout/tests/path_tests.cpp Lines 101-134 (patched) <https://reviews.apache.org/r/63238/#comment265972> Ditto. We can halve the amount of code by using `path::join`, and for cases where we have intermittent slashes etc., use `os::PATH_SEPARATOR` (I'd probably save that into a short local variable as it'll get referenced a lot in some of these.) 3rdparty/stout/tests/path_tests.cpp Lines 172-187 (patched) <https://reviews.apache.org/r/63238/#comment265973> Ditto. 3rdparty/stout/tests/path_tests.cpp Lines 212-235 (patched) <https://reviews.apache.org/r/63238/#comment265974> Now this is where it gets especially annoying, since we can't use `path::join` to test itself. But I would take: ``` EXPECT_EQ("\a\b\c\", path::join("\a\", "\b\", "\c\")); ``` and make it: ``` const string sep = stringify(os::PATH_SEPARATOR); EXPECT_EQ(sep + "a" + sep + "b" + sep + "c" + sep, path::join(sep + "a" + sep, sep + "b" + sep, sep + "c" + sep)); ``` At least this code can be reused, such that if the test gets changed, tests for both platforms are then updated always at the same time. - Andrew Schwartzmeyer On Oct. 24, 2017, 12:59 a.m., Raluca Miclea wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/63238/ > ----------------------------------------------------------- > > (Updated Oct. 24, 2017, 12:59 a.m.) > > > Review request for mesos and Andrew Schwartzmeyer. > > > Bugs: MESOS-3442 > https://issues.apache.org/jira/browse/MESOS-3442 > > > Repository: mesos > > > Description > ------- > > I checked #ifdefs in order to decide what tests to build and run on > Window and Posix systems respectively. > For Windows tests I mainly replaced the "slash" path separator with > "backslash". > I extracted common assertion before the #ifdef directive. > > > Diffs > ----- > > 3rdparty/stout/tests/path_tests.cpp > f8c14d5aefe0b49adb778da784143a328c96183d > > > Diff: https://reviews.apache.org/r/63238/diff/1/ > > > Testing > ------- > > Modified Tests: > TEST(PathTest, Basename) > TEST(PathTest, Dirname) > TEST(PathTest, Extension) > TEST(PathTest, Join) > > > Thanks, > > Raluca Miclea > >
