mirror of
https://github.com/rust-lang/cargo
synced 2024-08-25 02:25:46 +00:00
Fixes for some test errors on Windows.
This commit is contained in:
parent
e7eda2f91f
commit
00a47302dd
|
@ -1846,3 +1846,12 @@ pub fn symlink_supported() -> bool {
|
|||
pub fn symlink_supported() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// The error message for ENOENT.
|
||||
///
|
||||
/// It's generally not good to match against OS error messages, but I think
|
||||
/// this one is relatively stable.
|
||||
#[cfg(windows)]
|
||||
pub const NO_SUCH_FILE_ERR_MSG: &str = "The system cannot find the file specified. (os error 2)";
|
||||
#[cfg(not(windows))]
|
||||
pub const NO_SUCH_FILE_ERR_MSG: &str = "No such file or directory (os error 2)";
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
use cargo_test_support::{paths, project, registry::Package};
|
||||
|
||||
#[cargo_test]
|
||||
// I don't know why, but `Command` forces all env keys to be upper case on
|
||||
// Windows. Seems questionable, since I think Windows is case-preserving.
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn source_config_env() {
|
||||
// Try to define [source] with environment variables.
|
||||
let p = project()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use super::config::{
|
||||
assert_error, assert_match, read_output, write_config, write_config_at, ConfigBuilder,
|
||||
};
|
||||
use cargo_test_support::NO_SUCH_FILE_ERR_MSG;
|
||||
|
||||
#[cargo_test]
|
||||
fn gated() {
|
||||
|
@ -78,7 +79,8 @@ fn missing_file() {
|
|||
let config = ConfigBuilder::new().unstable_flag("config-include").build();
|
||||
assert_error(
|
||||
config.get::<i32>("whatever").unwrap_err(),
|
||||
"\
|
||||
&format!(
|
||||
"\
|
||||
could not load Cargo configuration
|
||||
|
||||
Caused by:
|
||||
|
@ -88,7 +90,9 @@ Caused by:
|
|||
failed to read configuration file `[..]/.cargo/missing`
|
||||
|
||||
Caused by:
|
||||
No such file or directory (os error 2)",
|
||||
{}",
|
||||
NO_SUCH_FILE_ERR_MSG
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -162,11 +166,14 @@ fn cli_include_failed() {
|
|||
.build_err();
|
||||
assert_error(
|
||||
config.unwrap_err(),
|
||||
"\
|
||||
&format!(
|
||||
"\
|
||||
failed to load --config include
|
||||
failed to load config include `foobar` from `--config cli option`
|
||||
failed to read configuration file `[..]/foobar`
|
||||
No such file or directory (os error 2)",
|
||||
{}",
|
||||
NO_SUCH_FILE_ERR_MSG
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use cargo_test_support::install::{
|
|||
};
|
||||
use cargo_test_support::paths;
|
||||
use cargo_test_support::registry::Package;
|
||||
use cargo_test_support::{basic_manifest, cargo_process, project};
|
||||
use cargo_test_support::{basic_manifest, cargo_process, project, NO_SUCH_FILE_ERR_MSG};
|
||||
|
||||
fn pkg(name: &str, vers: &str) {
|
||||
Package::new(name, vers)
|
||||
|
@ -824,11 +824,6 @@ fn uninstall_cwd_not_installed() {
|
|||
|
||||
#[cargo_test]
|
||||
fn uninstall_cwd_no_project() {
|
||||
let err_msg = if cfg!(windows) {
|
||||
"The system cannot find the file specified."
|
||||
} else {
|
||||
"No such file or directory"
|
||||
};
|
||||
cargo_process("uninstall")
|
||||
.with_status(101)
|
||||
.with_stdout("")
|
||||
|
@ -837,8 +832,8 @@ fn uninstall_cwd_no_project() {
|
|||
[ERROR] failed to read `[CWD]/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
{err_msg} (os error 2)",
|
||||
err_msg = err_msg,
|
||||
{err_msg}",
|
||||
err_msg = NO_SUCH_FILE_ERR_MSG,
|
||||
))
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ fn custom_runner_env() {
|
|||
p.cargo("run")
|
||||
.env(&key, "nonexistent-runner --foo")
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[RUNNING] `nonexistent-runner --foo target/debug/foo`")
|
||||
.with_stderr_contains("[RUNNING] `nonexistent-runner --foo target/debug/foo[EXE]`")
|
||||
.run();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue