Skip to content

Commit 8f5f6ee

Browse files
committed
[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
1 parent 16212b8 commit 8f5f6ee

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

libcxx/test/support/filesystem_test_helper.h

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ struct scoped_test_env
226226
return filename;
227227
}
228228

229-
std::string create_symlink(fs::path source_path,
230-
fs::path to_path,
231-
bool sanitize_source = true,
232-
bool is_dir = false) {
229+
std::string create_file_dir_symlink(fs::path source_path,
230+
fs::path to_path,
231+
bool sanitize_source = true,
232+
bool is_dir = false) {
233233
std::string source = source_path.string();
234234
std::string to = to_path.string();
235235
if (sanitize_source)
@@ -240,6 +240,20 @@ struct scoped_test_env
240240
return to;
241241
}
242242

243+
std::string create_symlink(fs::path source_path,
244+
fs::path to_path,
245+
bool sanitize_source = true) {
246+
return create_file_dir_symlink(source_path, to_path, sanitize_source,
247+
false);
248+
}
249+
250+
std::string create_directory_symlink(fs::path source_path,
251+
fs::path to_path,
252+
bool sanitize_source = true) {
253+
return create_file_dir_symlink(source_path, to_path, sanitize_source,
254+
true);
255+
}
256+
243257
std::string create_hardlink(fs::path source_path, fs::path to_path) {
244258
std::string source = source_path.string();
245259
std::string to = to_path.string();
@@ -325,12 +339,12 @@ class static_test_env {
325339
env_.create_dir("dir1/dir2/dir3");
326340
env_.create_file("dir1/dir2/dir3/file5");
327341
env_.create_file("dir1/dir2/file4");
328-
env_.create_symlink("dir3", "dir1/dir2/symlink_to_dir3", false, true);
342+
env_.create_directory_symlink("dir3", "dir1/dir2/symlink_to_dir3", false);
329343
env_.create_file("dir1/file1");
330344
env_.create_file("dir1/file2", 42);
331345
env_.create_file("empty_file");
332346
env_.create_file("non_empty_file", 42);
333-
env_.create_symlink("dir1", "symlink_to_dir", false, true);
347+
env_.create_directory_symlink("dir1", "symlink_to_dir", false);
334348
env_.create_symlink("empty_file", "symlink_to_empty_file", false);
335349
}
336350

0 commit comments

Comments
 (0)