test(core): remove temp dirs after tests via shared RAII helper

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5.5 committed 2026-11-16 19:23:09 +01:00
1 parent 09fbf79e87
commit 00226b4178
9 files changed
+115 -48

No files matched your search

+7 -12
View File
@@ -1,19 +1,14 @@
#![allow(dead_code)]
use grove_core::git::Git;
use std::fs;
use std::path::{Path, PathBuf};
use std::path::Path;
pub fn tmpdir(tag: &str) -> PathBuf {
let p = std::env::temp_dir().join(format!(
"grove-test-{tag}-{}-{}",
std::process::id(),
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos()
));
fs::create_dir_all(&p).unwrap();
p
#[path = "../../../../test-support/tmp.rs"]
pub mod tmp;
/// A unique temp dir that is removed (recursively) when dropped, also if the test fails.
pub fn tmpdir(tag: &str) -> tmp::TempDir {
tmp::TempDir::new(tag)
}
pub fn init(dir: &Path) -> Git {