mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +00:00
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:
1 parent
09fbf79e87
commit
00226b4178
9 files changed
+115
-48
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user