[libcxx-commits] [PATCH] D98215: [libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 8 15:37:37 PST 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp:53
TEST_CHECK(ret.is_absolute());
- TEST_CHECK(PathEq(ret, TC.expect));
+ TEST_CHECK(ret == TC.expect); // Separator agnostic comparison
+ LIBCPP_ONLY(TEST_CHECK(PathEq(ret, TC.expect)));
----------------
I'm no expert on <filesystem>, but based purely on cppreference, I wouldn't trust `path::operator==` to do the right thing. It definitely does more than just "separator-agnostic comparison":
https://en.cppreference.com/w/cpp/filesystem/path/compare
I see no problem with D98109 (tightening up the output of `absolute`). It sounds like you're planning to abandon D98109 and keep the loosey-goosey output, which means the test code will need a "separator-agnostic comparison" function. Instead of using `==`, how about making a helper function like `PathEq` that simply calls `.make_preferred()` on both paths and then strcmps them? Then we know we're not relying on any other weirdness introduced by `path::operator==`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98215/new/
https://reviews.llvm.org/D98215
More information about the libcxx-commits
mailing list