[libcxx-commits] [libcxx] 8f5f6ee - [libcxx] [test] Make a separate create_directory_symlink helper
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 10 00:44:10 PST 2020
Author: Martin Storsjö
Date: 2020-11-10T10:39:15+02:00
New Revision: 8f5f6ee27e3e20edf3b77220e660179b5981e129
URL: https://github.com/llvm/llvm-project/commit/8f5f6ee27e3e20edf3b77220e660179b5981e129
DIFF: https://github.com/llvm/llvm-project/commit/8f5f6ee27e3e20edf3b77220e660179b5981e129.diff
LOG: [libcxx] [test] Make a separate create_directory_symlink helper
This more closely mirrors the public API, instead of using an
obscure bool parameter.
Differential Revision: https://reviews.llvm.org/D91071
Added:
Modified:
libcxx/test/support/filesystem_test_helper.h
Removed:
################################################################################
diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index 636eeecb637c..8ce4c3e939d5 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -226,10 +226,10 @@ struct scoped_test_env
return filename;
}
- std::string create_symlink(fs::path source_path,
- fs::path to_path,
- bool sanitize_source = true,
- bool is_dir = false) {
+ std::string create_file_dir_symlink(fs::path source_path,
+ fs::path to_path,
+ bool sanitize_source = true,
+ bool is_dir = false) {
std::string source = source_path.string();
std::string to = to_path.string();
if (sanitize_source)
@@ -240,6 +240,20 @@ struct scoped_test_env
return to;
}
+ std::string create_symlink(fs::path source_path,
+ fs::path to_path,
+ bool sanitize_source = true) {
+ return create_file_dir_symlink(source_path, to_path, sanitize_source,
+ false);
+ }
+
+ std::string create_directory_symlink(fs::path source_path,
+ fs::path to_path,
+ bool sanitize_source = true) {
+ return create_file_dir_symlink(source_path, to_path, sanitize_source,
+ true);
+ }
+
std::string create_hardlink(fs::path source_path, fs::path to_path) {
std::string source = source_path.string();
std::string to = to_path.string();
@@ -325,12 +339,12 @@ class static_test_env {
env_.create_dir("dir1/dir2/dir3");
env_.create_file("dir1/dir2/dir3/file5");
env_.create_file("dir1/dir2/file4");
- env_.create_symlink("dir3", "dir1/dir2/symlink_to_dir3", false, true);
+ env_.create_directory_symlink("dir3", "dir1/dir2/symlink_to_dir3", false);
env_.create_file("dir1/file1");
env_.create_file("dir1/file2", 42);
env_.create_file("empty_file");
env_.create_file("non_empty_file", 42);
- env_.create_symlink("dir1", "symlink_to_dir", false, true);
+ env_.create_directory_symlink("dir1", "symlink_to_dir", false);
env_.create_symlink("empty_file", "symlink_to_empty_file", false);
}
More information about the libcxx-commits
mailing list