mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
mktemp: fix both_tmpdir_flags_present test on windows
This commit is contained in:
parent
536db164bf
commit
964b1d6e10
1 changed files with 14 additions and 1 deletions
|
@ -923,7 +923,10 @@ fn test_missing_xs_tmpdir_template() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_both_tmpdir_flags_present() {
|
fn test_both_tmpdir_flags_present() {
|
||||||
let scene = TestScenario::new(util_name!());
|
let scene = TestScenario::new(util_name!());
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
let template = format!(".{MAIN_SEPARATOR}foobarXXXX");
|
let template = format!(".{MAIN_SEPARATOR}foobarXXXX");
|
||||||
|
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
let result = ucmd
|
let result = ucmd
|
||||||
.env(TMPDIR, ".")
|
.env(TMPDIR, ".")
|
||||||
|
@ -933,14 +936,19 @@ fn test_both_tmpdir_flags_present() {
|
||||||
.arg("foobarXXXX")
|
.arg("foobarXXXX")
|
||||||
.succeeds();
|
.succeeds();
|
||||||
let filename = result.no_stderr().stdout_str().trim_end();
|
let filename = result.no_stderr().stdout_str().trim_end();
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
assert_matches_template!(&template, filename);
|
assert_matches_template!(&template, filename);
|
||||||
|
#[cfg(windows)]
|
||||||
|
assert_suffix_matches_template!("foobarXXXX", filename);
|
||||||
|
|
||||||
assert!(at.file_exists(filename));
|
assert!(at.file_exists(filename));
|
||||||
|
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg(".")
|
.arg(".")
|
||||||
.arg("--tmpdir=doesnotexist")
|
.arg("--tmpdir=does_not_exist")
|
||||||
.fails()
|
.fails()
|
||||||
.no_stdout()
|
.no_stdout()
|
||||||
.stderr_contains("failed to create file via template");
|
.stderr_contains("failed to create file via template");
|
||||||
|
@ -953,7 +961,12 @@ fn test_both_tmpdir_flags_present() {
|
||||||
.arg(".")
|
.arg(".")
|
||||||
.succeeds();
|
.succeeds();
|
||||||
let filename = result.no_stderr().stdout_str().trim_end();
|
let filename = result.no_stderr().stdout_str().trim_end();
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
assert_matches_template!(&template, filename);
|
assert_matches_template!(&template, filename);
|
||||||
|
#[cfg(windows)]
|
||||||
|
assert_suffix_matches_template!("foobarXXXX", filename);
|
||||||
|
|
||||||
assert!(at.file_exists(filename));
|
assert!(at.file_exists(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue