Skip to content

Commit

Permalink
fixup! mktemp: respect TMPDIR environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels committed Sep 6, 2022
1 parent 6d864fc commit fb82c02
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/by-util/test_mktemp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ macro_rules! assert_matches_template {
}

/// Like [`assert_matches_template`] but for the suffix of a string.
#[cfg(windows)]
macro_rules! assert_suffix_matches_template {
($template:expr, $s:expr) => {{
let n = ($s).len();
Expand Down Expand Up @@ -699,10 +700,7 @@ fn test_tmpdir_env_var() {
// * https://doc.rust-lang.org/std/env/fn.temp_dir.html
// * https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w
#[cfg(windows)]
{
let template = "tmp.XXXXXXXXXX";
assert_suffix_matches_template!(&template, filename);
}
assert_suffix_matches_template!("tmp.XXXXXXXXXX", filename);
assert!(at.file_exists(filename));

// FIXME This is not working because --tmpdir is configured to
Expand All @@ -726,10 +724,7 @@ fn test_tmpdir_env_var() {
assert_matches_template!(&template, filename);
}
#[cfg(windows)]
{
let template = "XXX";
assert_suffix_matches_template!(&template, filename);
}
assert_suffix_matches_template!("XXX", filename);
assert!(at.file_exists(filename));

// `TMPDIR=. mktemp XXX` - in this case `TMPDIR` is ignored.
Expand Down

0 comments on commit fb82c02

Please sign in to comment.