}
/// 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)";
+pub fn no_such_file_err_msg() -> String {
+ std::io::Error::from_raw_os_error(2).to_string()
+}
use super::config::{
assert_error, assert_match, read_output, write_config, write_config_at, ConfigBuilder,
};
-use cargo_test_support::{paths, NO_SUCH_FILE_ERR_MSG};
+use cargo_test_support::{no_such_file_err_msg, paths};
use std::fs;
#[cargo_test]
Caused by:
{}",
- NO_SUCH_FILE_ERR_MSG
+ no_such_file_err_msg()
),
);
}
Caused by:
{}",
- NO_SUCH_FILE_ERR_MSG
+ no_such_file_err_msg()
),
);
}
use cargo_test_support::paths;
use cargo_test_support::registry::Package;
use cargo_test_support::{
- basic_manifest, cargo_process, project, symlink_supported, t, NO_SUCH_FILE_ERR_MSG,
+ basic_manifest, cargo_process, no_such_file_err_msg, project, symlink_supported, t,
};
fn pkg(name: &str, vers: &str) {
Caused by:
{err_msg}",
- err_msg = NO_SUCH_FILE_ERR_MSG,
+ err_msg = no_such_file_err_msg(),
))
.run();
}