2
2
3
3
use std:: fs;
4
4
5
- use snapbox:: str;
6
-
7
5
use cargo_test_support:: registry:: RegistryBuilder ;
8
6
use cargo_test_support:: {
9
7
basic_bin_manifest, cargo_test, project, symlink_supported, Execs , ProjectBuilder ,
@@ -177,15 +175,21 @@ fn assert_broken_symlink(
177
175
assert ! ( !p. root( ) . join( src) . is_dir( ) ) ;
178
176
let registry = RegistryBuilder :: new ( ) . http_api ( ) . http_index ( ) . build ( ) ;
179
177
178
+ let err_msg = if !cfg ! ( windows) {
179
+ "File exists (os error 17)"
180
+ } else {
181
+ "Cannot create a file when that file already exists. (os error 183)"
182
+ } ;
183
+
184
+
180
185
make_execs ( & mut p. cargo ( command) , lockfile_path_argument. to_string ( ) )
181
186
. with_status ( 101 )
182
- . with_stderr_data ( str! [ [ r#"
183
- [ERROR] Failed to create lockfile-path parent directory somedir/link
187
+ . with_stderr_data ( & format ! (
188
+ r#" [ERROR] Failed to create lockfile-path parent directory somedir/link
184
189
185
190
Caused by:
186
- File exists (os error 17)
187
-
188
- "# ] ] )
191
+ {}
192
+ "# , err_msg) )
189
193
. replace_crates_io ( registry. index_url ( ) )
190
194
. run ( ) ;
191
195
}
@@ -210,15 +214,22 @@ fn assert_loop_symlink(
210
214
assert ! ( !p. root( ) . join( src) . is_dir( ) ) ;
211
215
let registry = RegistryBuilder :: new ( ) . http_api ( ) . http_index ( ) . build ( ) ;
212
216
217
+ let err_msg = if cfg ! ( windows) {
218
+ "The name of the file cannot be resolved by the system. (os error 1921)"
219
+ } else if cfg ! ( target_os = "macos" ) {
220
+ "Too many levels of symbolic links (os error 62)"
221
+ } else {
222
+ "Too many levels of symbolic links (os error 40)"
223
+ } ;
224
+
213
225
make_execs ( & mut p. cargo ( command) , lockfile_path_argument. to_string ( ) )
214
226
. with_status ( 101 )
215
- . with_stderr_data ( str! [ [ r#"
216
- [ERROR] Failed to fetch lock file's parent path metadata somedir/link
227
+ . with_stderr_data ( & format ! (
228
+ r#" [ERROR] Failed to fetch lock file's parent path metadata somedir/link
217
229
218
230
Caused by:
219
- Too many levels of symbolic links (os error 40)
220
-
221
- "# ] ] )
231
+ {}
232
+ "# , err_msg) )
222
233
. replace_crates_io ( registry. index_url ( ) )
223
234
. run ( ) ;
224
235
}
0 commit comments