mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-31 21:27:00 -06:00
Merge pull request #4766 from mockydevs/fix/testkit-temp-dir-private-setup
Testkit: the temp_dir test pre-makes a private directory, as temp_dir does
This commit is contained in:
@@ -111,7 +111,13 @@ mod tests {
|
||||
fn a_temp_dir_starts_empty_in_a_process_and_stays_for_later_calls() {
|
||||
let tag = "fresh-temp-dir";
|
||||
let left = std::env::temp_dir().join(format!("vectorcraft-testkit-{tag}-{}", std::process::id()));
|
||||
std::fs::create_dir_all(left.join("nested")).unwrap();
|
||||
// Made private, as `temp_dir` makes it: a directory others can reach is refused, not reused.
|
||||
#[cfg_attr(not(unix), allow(unused_mut))]
|
||||
let mut b = std::fs::DirBuilder::new();
|
||||
b.recursive(true);
|
||||
#[cfg(unix)]
|
||||
std::os::unix::fs::DirBuilderExt::mode(&mut b, 0o700);
|
||||
b.create(left.join("nested")).unwrap();
|
||||
std::fs::write(left.join("left.txt"), b"an earlier process").unwrap();
|
||||
let dir = super::temp_dir(tag);
|
||||
assert_eq!(dir, left);
|
||||
|
||||
Reference in New Issue
Block a user