[libcxx-commits] [libcxx] [libc++] Make std::filesystem::canonical throw when given empty path (PR #77223)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jan 7 04:35:31 PST 2024
================
@@ -92,6 +92,26 @@ static void test_dne_path()
}
}
+static void test_empty_path() {
+ std::error_code ec = GetTestEC();
+ {
+ const path ret = canonical(path{}, ec);
+ assert(ec != GetTestEC());
+ assert(ec);
+ assert(ret == path{});
+ }
+ { TEST_THROWS_TYPE(filesystem_error, canonical(path{})); }
+
+ ec = GetTestEC();
+ {
+ const path ret = canonical("", ec);
+ assert(ec != GetTestEC());
+ assert(ec);
+ assert(ret == path{});
+ }
+ { TEST_THROWS_TYPE(filesystem_error, canonical("")); }
+}
----------------
mordante wrote:
We don't need this test, elsewhere should be tested `path{} == ""`.
https://github.com/llvm/llvm-project/pull/77223
More information about the libcxx-commits
mailing list