Details
- Reviewers
ldionne curdeius zoecarver Mordante • Quuxplusone - Group Reviewers
Restricted Project - Commits
- rG53d7c6365759: [libcxx] [test] Use separate references for windows in the path.append test
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp | ||
---|---|---|
147 | I'm not sure I understand, can you give me an example of why this fails on Windows with PathEq? |
libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp | ||
---|---|---|
147 | PathEq checks that the strings are literally identical, while path::operator== checks that the paths mean the same (i.e. tolerating both slash forms on windows). When we test appending p2 to p1 on windows, we get the path p1\p2, but the test reference is p1/p2. We can't just run make_preferred() on the reference and do a literal comparison either: If the original path is p1/p2 and we append p3, we get p1/p2\p3. So this weakens the test a bit (it doesn't distinguish between p1/p2 and p1//p2 iirc either), but is a simple change to make. The alternative would be to ifdef the whole table and add duplicate references (or to add ref_posix, ref_windows in each table entry). Thinking of it now (3 months later), the last option actually sounds pretty good although it makes the patch messier. |
Adding more reviewers on this one too. (Contrary to the other patches, this one doesn't have one earlier LGTM though - but it's been updated according to what was discussed with Louis earlier.)
libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp | ||
---|---|---|
147 | To add some context here - I discussed this one with Louis outside of Phabricator back after this review, and we agreed that adding separate references for the expected result for both cases is the best way to go. |
LGTM if we get rid of the expect macro.
libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp | ||
---|---|---|
55–56 | 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. |
libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp | ||
---|---|---|
55–56 | That sounds good, thanks, will do. I'll go with a member function in this case, not that it really matters. |
Let's use a function for this:
Then, use expected_result(TC) below instead of TC.expect. WDYT? Feel free to make it a member function if you prefer.