[libcxx-commits] [PATCH] D91071: [libcxx] [test] Make a separate create_directory_symlink helper. NFC.

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 9 05:54:46 PST 2020


mstorsjo created this revision.
mstorsjo added a reviewer: libc++.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
mstorsjo requested review of this revision.

This more closely mirrors the public API, instead of using an obscure bool parameter.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91071

Files:
  libcxx/test/support/filesystem_test_helper.h


Index: libcxx/test/support/filesystem_test_helper.h
===================================================================
--- libcxx/test/support/filesystem_test_helper.h
+++ libcxx/test/support/filesystem_test_helper.h
@@ -226,10 +226,10 @@
         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 @@
         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 @@
         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);
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91071.303844.patch
Type: text/x-patch
Size: 2463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201109/b708f3bf/attachment.bin>


More information about the libcxx-commits mailing list