This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix lexically_normal and lexically_relative_and_proximate for windows
ClosedPublic

Authored by mstorsjo on Mar 5 2021, 11:53 PM.

Details

Summary

Convert the expected result path to preferred separators, add exceptions
to the test results where needed (due to some cases being interpreted
as a root name).

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Mar 5 2021, 11:53 PM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2021, 11:53 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
curdeius added inline comments.
libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
42

Unless I am mistaken, the test case for //base is identical for Win32 and other platforms.

mstorsjo added inline comments.Mar 6 2021, 5:26 AM
libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
42

Thanks, looks like you're right. Updating...

mstorsjo updated this revision to Diff 328758.Mar 6 2021, 5:27 AM

Un-ifdef a testcase that was identical in both cases

Quuxplusone added a subscriber: Quuxplusone.

LGTM!

libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
88

Potential drive-by clarity improvement: Here we construct proximate_expected from the old value of output, rather than from expect. This works, because by the time we reach this line, it is guaranteed that PathEq(output, expect). Still, IMHO, this code would be less confusing if you replaced the identifier output on this line with the identifier expect. Plus, fix the argument order to PathEq so that it's parallel to the order on line 81.

const fs::path proximate_expect = expect.empty() ? p : expect;
if (!PathEq(proximate_output, proximate_expect))
  ~~~

Not a blocker, but I think it'd be nice.

mstorsjo added inline comments.Mar 6 2021, 9:19 AM
libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
88

Sure, I can do a separate change to improve the consistency that way.

curdeius accepted this revision.Mar 6 2021, 12:18 PM

LGTM.

This revision is now accepted and ready to land.Mar 6 2021, 12:18 PM