From 4943517327f8cf003c35de034bc6c8a270f8e575 Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Wed, 25 Aug 2021 17:25:40 +0200 Subject: [PATCH] wc: Adjust expected error messages for Windows --- tests/by-util/test_wc.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index c567c0dd5..f74cd7b9d 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -205,22 +205,27 @@ fn test_file_bytes_dictate_width() { /// Test that getting counts from a directory is an error. #[test] fn test_read_from_directory_error() { - // TODO To match GNU `wc`, the `stdout` should be: - // - // " 0 0 0 .\n" - // + #[cfg(not(windows))] + const MSG: &str = ".: Is a directory"; + #[cfg(windows)] + const MSG: &str = ".: Access is denied"; new_ucmd!() .args(&["."]) .fails() - .stderr_contains(".: Is a directory") + .stderr_contains(MSG) .stdout_is(" 0 0 0 .\n"); } /// Test that getting counts from nonexistent file is an error. #[test] 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!() .args(&["bogusfile"]) .fails() - .stderr_contains("bogusfile: No such file or directory"); + .stderr_contains(MSG) + .stdout_is(""); }