From 7e192253a726c0fb1afa65bf5ab6dedbbecc744f Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 18 Sep 2022 12:38:01 -0400 Subject: [PATCH] fixup! mktemp: add message for directory not found --- tests/by-util/test_mktemp.rs | 48 ++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 1d5b943580e..af6e4656a39 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -745,8 +745,16 @@ fn test_nonexistent_tmpdir_env_var() { let result = new_ucmd!().env(TMPDIR, r"no\such\dir").fails(); result.no_stdout(); let stderr = result.stderr_str(); - assert!(stderr.starts_with("mktemp: failed to create file via template")); - assert!(stderr.ends_with(r"no\such\dir/tmp.XXXXXXXXXX': No such file or directory\n")); + assert!( + stderr.starts_with("mktemp: failed to create file via template"), + "{}", + stderr + ); + assert!( + stderr.ends_with("no\\such\\dir/tmp.XXXXXXXXXX': No such file or directory\n"), + "{}", + stderr + ); } #[cfg(not(windows))] @@ -756,8 +764,16 @@ fn test_nonexistent_tmpdir_env_var() { let result = new_ucmd!().env(TMPDIR, r"no\such\dir").arg("-d").fails(); result.no_stdout(); let stderr = result.stderr_str(); - assert!(stderr.starts_with("mktemp: failed to create directory via template")); - assert!(stderr.ends_with(r"no\such\dir/tmp.XXXXXXXXXX': No such file or directory\n")); + assert!( + stderr.starts_with("mktemp: failed to create directory via template"), + "{}", + stderr + ); + assert!( + stderr.ends_with("no\\such\\dir/tmp.XXXXXXXXXX': No such file or directory\n"), + "{}", + stderr + ); } } @@ -772,8 +788,16 @@ fn test_nonexistent_dir_prefix() { let result = new_ucmd!().arg(r"d\XXX").fails(); result.no_stdout(); let stderr = result.stderr_str(); - assert!(stderr.starts_with("mktemp: failed to create file via template")); - assert!(stderr.ends_with(r"d\XXX': No such file or directory\n")); + assert!( + stderr.starts_with("mktemp: failed to create file via template"), + "{}", + stderr + ); + assert!( + stderr.ends_with("d\\XXX': No such file or directory\n"), + "{}", + stderr + ); } #[cfg(not(windows))] @@ -785,7 +809,15 @@ fn test_nonexistent_dir_prefix() { let result = new_ucmd!().arg("-d").arg(r"d\XXX").fails(); result.no_stdout(); let stderr = result.stderr_str(); - assert!(stderr.starts_with("mktemp: failed to create file via template")); - assert!(stderr.ends_with(r"d\XXX': No such file or directory\n")); + assert!( + stderr.starts_with("mktemp: failed to create file via template"), + "{}", + stderr + ); + assert!( + stderr.ends_with("d\\XXX': No such file or directory\n"), + "{}", + stderr + ); } }