This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix string type handling in a few fairly trivial class.path tests
ClosedPublic

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

Details

Summary

Use string() for convenience for testing where possible, but keep using native() for move tests where we want to check that no allocations are made, constructing a reference fs::path::string_type instead.

Use the right value_type in a few places.

Make the synop test check for the right types and for the expected preferred separator.

Diff Detail

Event Timeline

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

Why don't you create s directly as fs::path::string_type?

libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
32

Same

libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp
31

Same.

libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp
29

Same.

libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp
31

Same.

libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
28

Just create them as strings from the get go?

This revision now requires changes to proceed.Oct 16 2020, 5:40 AM
mstorsjo added inline comments.Oct 16 2020, 8:40 AM
libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
29

How does one construct a wstring from a non-wide char pointer/literal? Or do you suggest adding a wrapper in some header to wrap the literal, for optionally adding the L prefix?

ldionne accepted this revision.Oct 16 2020, 9:35 AM
ldionne added inline comments.
libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
29

Ah, you're right. That's why I phrased it as "why don't you" :-)

This revision is now accepted and ready to land.Oct 16 2020, 9:35 AM