This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix path.modifiers/make_preferred for windows
ClosedPublic

Authored by mstorsjo on Oct 16 2020, 3:33 AM.

Details

Summary

Use p.string() instead of p.native() for comparing with the expected value.

Explicitly list the expected values for both posix and windos, even if the operation is an identity operation on posix.

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 16 2020, 3:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2020, 3:33 AM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript
mstorsjo requested review of this revision.Oct 16 2020, 3:33 AM
ldionne requested changes to this revision.Oct 16 2020, 5:48 AM
ldionne added a subscriber: ldionne.
ldionne added inline comments.
libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
35–41

I would rather this be changed to:

struct MakePreferredTestcase {
  const char* value;
  const char* expected_posix;
  const char* expected_windows;
};

and then

const MakePreferredTestcase TestCases[] = {
      {"", "", ""}
    , {"hello_world", "", ""}
    , {"/", "/", "\\"}
    , {"/foo/bar/baz/", "/foo/bar/baz/", "\\foo\\bar\\baz\\"}
    , {"\\", "\\", "\\"}
    , ...
};

I find it easier to follow.

This revision now requires changes to proceed.Oct 16 2020, 5:48 AM
mstorsjo updated this revision to Diff 298714.Oct 16 2020, 12:14 PM
mstorsjo edited the summary of this revision. (Show Details)

Updated according to suggestions.

@ldionne Any more comments on this?

ldionne accepted this revision.Oct 20 2020, 9:06 AM
This revision is now accepted and ready to land.Oct 20 2020, 9:06 AM