mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fix mktemp test for windows
This commit is contained in:
parent
6262a3e9d9
commit
536db164bf
1 changed files with 18 additions and 12 deletions
|
@ -923,32 +923,38 @@ 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!());
|
||||||
scene
|
let template = format!(".{MAIN_SEPARATOR}foobarXXXX");
|
||||||
.ucmd()
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
let result = ucmd
|
||||||
|
.env(TMPDIR, ".")
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg(".")
|
.arg("nonsense")
|
||||||
.arg("--tmpdir")
|
.arg("--tmpdir")
|
||||||
.arg("foobarXXXX")
|
.arg("foobarXXXX")
|
||||||
.succeeds()
|
.succeeds();
|
||||||
.no_stderr()
|
let filename = result.no_stderr().stdout_str().trim_end();
|
||||||
.stdout_contains("/tmp/foobar");
|
assert_matches_template!(&template, filename);
|
||||||
|
assert!(at.file_exists(filename));
|
||||||
|
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg(".")
|
.arg(".")
|
||||||
.arg("--tmpdir=foobarXXXX")
|
.arg("--tmpdir=doesnotexist")
|
||||||
.fails()
|
.fails()
|
||||||
.no_stdout()
|
.no_stdout()
|
||||||
.stderr_contains("failed to create file via template");
|
.stderr_contains("failed to create file via template");
|
||||||
scene
|
|
||||||
.ucmd()
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
let result = ucmd
|
||||||
.arg("--tmpdir")
|
.arg("--tmpdir")
|
||||||
.arg("foobarXXXX")
|
.arg("foobarXXXX")
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg(".")
|
.arg(".")
|
||||||
.succeeds()
|
.succeeds();
|
||||||
.no_stderr()
|
let filename = result.no_stderr().stdout_str().trim_end();
|
||||||
.stdout_contains("./foobar");
|
assert_matches_template!(&template, filename);
|
||||||
|
assert!(at.file_exists(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue