8
8
9
9
// UNSUPPORTED: c++03
10
10
11
+ // This test requires the dylib support introduced in D92769.
12
+ // XFAIL: with_system_cxx_lib=macosx10.15
13
+
11
14
// <filesystem>
12
15
13
16
// bool create_directories(const path& p);
@@ -75,12 +78,12 @@ TEST_CASE(create_directory_symlinks) {
75
78
std::error_code ec = GetTestEC ();
76
79
TEST_CHECK (create_directories (target, ec) == false );
77
80
TEST_CHECK (ec);
81
+ TEST_CHECK (ErrorIs (ec, std::errc::file_exists));
78
82
TEST_CHECK (!exists (sym_dest_dead));
79
83
TEST_CHECK (!exists (dead_sym));
80
84
}
81
85
}
82
86
83
-
84
87
TEST_CASE (create_directory_through_symlinks) {
85
88
scoped_test_env env;
86
89
const path root = env.create_dir (" dir" );
@@ -97,4 +100,42 @@ TEST_CASE(create_directory_through_symlinks) {
97
100
}
98
101
}
99
102
103
+ TEST_CASE (dest_is_file)
104
+ {
105
+ scoped_test_env env;
106
+ const path file = env.create_file (" file" , 42 );
107
+ std::error_code ec = GetTestEC ();
108
+ TEST_CHECK (fs::create_directories (file, ec) == false );
109
+ TEST_CHECK (ec);
110
+ TEST_CHECK (ErrorIs (ec, std::errc::file_exists));
111
+ TEST_CHECK (is_regular_file (file));
112
+ }
113
+
114
+ TEST_CASE (dest_part_is_file)
115
+ {
116
+ scoped_test_env env;
117
+ const path file = env.create_file (" file" );
118
+ const path dir = env.make_env_path (" file/dir1" );
119
+ std::error_code ec = GetTestEC ();
120
+ TEST_CHECK (fs::create_directories (dir, ec) == false );
121
+ TEST_CHECK (ec);
122
+ TEST_CHECK (ErrorIs (ec, std::errc::not_a_directory));
123
+ TEST_CHECK (is_regular_file (file));
124
+ TEST_CHECK (!exists (dir));
125
+ }
126
+
127
+ TEST_CASE (dest_final_part_is_file)
128
+ {
129
+ scoped_test_env env;
130
+ env.create_dir (" dir" );
131
+ const path file = env.create_file (" dir/file" );
132
+ const path dir = env.make_env_path (" dir/file/dir1" );
133
+ std::error_code ec = GetTestEC ();
134
+ TEST_CHECK (fs::create_directories (dir, ec) == false );
135
+ TEST_CHECK (ec);
136
+ TEST_CHECK (ErrorIs (ec, std::errc::not_a_directory));
137
+ TEST_CHECK (is_regular_file (file));
138
+ TEST_CHECK (!exists (dir));
139
+ }
140
+
100
141
TEST_SUITE_END ()
0 commit comments