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 + ); } }