wc: Adjust expected error messages for Windows

This commit is contained in:
Jan Verbeek 2021-08-25 17:25:40 +02:00 committed by Michael Debertol
parent 0f1e79fe29
commit 4943517327

View file

@ -205,22 +205,27 @@ fn test_file_bytes_dictate_width() {
/// Test that getting counts from a directory is an error. /// Test that getting counts from a directory is an error.
#[test] #[test]
fn test_read_from_directory_error() { fn test_read_from_directory_error() {
// TODO To match GNU `wc`, the `stdout` should be: #[cfg(not(windows))]
// const MSG: &str = ".: Is a directory";
// " 0 0 0 .\n" #[cfg(windows)]
// const MSG: &str = ".: Access is denied";
new_ucmd!() new_ucmd!()
.args(&["."]) .args(&["."])
.fails() .fails()
.stderr_contains(".: Is a directory") .stderr_contains(MSG)
.stdout_is(" 0 0 0 .\n"); .stdout_is(" 0 0 0 .\n");
} }
/// Test that getting counts from nonexistent file is an error. /// Test that getting counts from nonexistent file is an error.
#[test] #[test]
fn test_read_from_nonexistent_file() { fn test_read_from_nonexistent_file() {
#[cfg(not(windows))]
const MSG: &str = "bogusfile: No such file or directory";
#[cfg(windows)]
const MSG: &str = "bogusfile: The system cannot find the file specified";
new_ucmd!() new_ucmd!()
.args(&["bogusfile"]) .args(&["bogusfile"])
.fails() .fails()
.stderr_contains("bogusfile: No such file or directory"); .stderr_contains(MSG)
.stdout_is("");
} }