Previously both threw an error if the file didn't exist.
PR#35780
Differential D41830
[libc++] Fix PR#35780 - make std::experimental::filesystem::remove and remove_all return false or 0 if the file doesn't exist TyanNN on Jan 8 2018, 11:48 AM. Authored by
Details
Previously both threw an error if the file didn't exist. PR#35780
Diff Detail
Event Timeline
Comment Actions Fix remove and remove_all error resetting. Move test to the appropriate files and fix old tests.
Comment Actions I like the fact that you've removed the extra test that you've added. For remove, that would be path("dne") and path("") . Just FYI - I believe that 'dne' is Eric's shorthand for "does not exist". Something like this: TEST_CASE(basic_remove_test) { scoped_test_env env; const path dne = env.make_env_path("dne"); const path link = env.create_symlink(dne, "link"); const path nested_link = env.make_env_path("nested_link"); create_symlink(link, nested_link); const path testCases1[] = { env.create_file("file", 42), env.create_dir("empty_dir"), nested_link, link }; for (auto& p : testCases1) { std::error_code ec = std::make_error_code(std::errc::address_in_use); TEST_CHECK(remove(p, ec)); TEST_CHECK(!ec); TEST_CHECK(!exists(symlink_status(p))); } // This is https://bugs.llvm.org/show_bug.cgi?id=35780 const path testCases2[] = { env.make_env_path("dne"), "" }; for (auto& p : testCases2) { std::error_code ec = std::make_error_code(std::errc::address_in_use); TEST_CHECK(!remove(p, ec)); TEST_CHECK(!ec); TEST_CHECK(!exists(symlink_status(p))); } }
|
This test is incorrect. ec isn't passed to the function.