[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
Thu Dec 10 04:56:43 PST 2020
curdeius created this revision.
curdeius added reviewers: ldionne, mstorsjo.
curdeius requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
That's a follow-up patch after D92769 <https://reviews.llvm.org/D92769>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93026
Files:
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
@@ -80,7 +80,6 @@
}
}
-
TEST_CASE(create_directory_through_symlinks) {
scoped_test_env env;
const path root = env.create_dir("dir");
@@ -97,4 +96,39 @@
}
}
+TEST_CASE(dest_is_file)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(fs::create_directories(file, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(is_regular_file(file));
+}
+
+TEST_CASE(dest_part_is_file)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file");
+ const path dir = env.make_env_path("file/dir1");
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(fs::create_directories(dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(is_regular_file(file));
+ TEST_CHECK(!exists(dir));
+}
+
+TEST_CASE(dest_final_part_is_file)
+{
+ scoped_test_env env;
+ env.create_dir("dir");
+ const path file = env.create_file("dir/file");
+ const path dir = env.make_env_path("dir/file/dir1");
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(fs::create_directories(dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(is_regular_file(file));
+ TEST_CHECK(!exists(dir));
+}
+
TEST_SUITE_END()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93026.310850.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201210/7253376d/attachment-0001.bin>
More information about the libcxx-commits
mailing list