mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
test: lockfile path test refactoring
- win/mac fix
This commit is contained in:
parent
c25dcf00df
commit
066b291a41
@ -2,8 +2,6 @@
|
||||
|
||||
use std::fs;
|
||||
|
||||
use snapbox::str;
|
||||
|
||||
use cargo_test_support::registry::RegistryBuilder;
|
||||
use cargo_test_support::{
|
||||
basic_bin_manifest, cargo_test, project, symlink_supported, Execs, ProjectBuilder,
|
||||
@ -177,15 +175,21 @@ fn assert_broken_symlink(
|
||||
assert!(!p.root().join(src).is_dir());
|
||||
let registry = RegistryBuilder::new().http_api().http_index().build();
|
||||
|
||||
let err_msg = if !cfg!(windows) {
|
||||
"File exists (os error 17)"
|
||||
} else {
|
||||
"Cannot create a file when that file already exists. (os error 183)"
|
||||
};
|
||||
|
||||
|
||||
make_execs(&mut p.cargo(command), lockfile_path_argument.to_string())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] Failed to create lockfile-path parent directory somedir/link
|
||||
.with_stderr_data(&format!(
|
||||
r#"[ERROR] Failed to create lockfile-path parent directory somedir/link
|
||||
|
||||
Caused by:
|
||||
File exists (os error 17)
|
||||
|
||||
"#]])
|
||||
{}
|
||||
"#, err_msg))
|
||||
.replace_crates_io(registry.index_url())
|
||||
.run();
|
||||
}
|
||||
@ -210,15 +214,22 @@ fn assert_loop_symlink(
|
||||
assert!(!p.root().join(src).is_dir());
|
||||
let registry = RegistryBuilder::new().http_api().http_index().build();
|
||||
|
||||
let err_msg = if cfg!(windows) {
|
||||
"The name of the file cannot be resolved by the system. (os error 1921)"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"Too many levels of symbolic links (os error 62)"
|
||||
} else {
|
||||
"Too many levels of symbolic links (os error 40)"
|
||||
};
|
||||
|
||||
make_execs(&mut p.cargo(command), lockfile_path_argument.to_string())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] Failed to fetch lock file's parent path metadata somedir/link
|
||||
.with_stderr_data(&format!(
|
||||
r#"[ERROR] Failed to fetch lock file's parent path metadata somedir/link
|
||||
|
||||
Caused by:
|
||||
Too many levels of symbolic links (os error 40)
|
||||
|
||||
"#]])
|
||||
{}
|
||||
"#, err_msg))
|
||||
.replace_crates_io(registry.index_url())
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user