[libcxx-commits] [PATCH] D93026: [libc++] [P1164] Add tests for create_directories. NFC.

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 14 04:28:58 PST 2020


curdeius marked an inline comment as done.
curdeius added inline comments.


================
Comment at: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp:107
+    TEST_CHECK(ec);
+    TEST_CHECK(ec == std::errc::file_exists);
+    TEST_CHECK(is_regular_file(file));
----------------
mstorsjo wrote:
> Btw, the filesystem tests has got a helper function, that would allow writing this as `ErrorIs(ec, std::errc::file_exists)` - but I verified that this form also seems to work.
> 
> The thing is, that with MS STL, the returned error codes don't use the standard `std::errc` values and category, but wrap the windows native error codes. The `ErrorIs()` helper explicitly converts them to the generic error category (via `ec.default_error_condition()`) before comparing error values, but it looks like `operator==()` does the same as well, implicitly.
Ok, I use `ErrorIs` now, even it doesn't change much. But it may be future proof.
Do you have a scenario where the returned error code would be unintuitive?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93026/new/

https://reviews.llvm.org/D93026



More information about the libcxx-commits mailing list