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

+2 -2
View File
@@ -73,8 +73,8 @@ mod tests {
#[test]
fn marker_lifecycle() {
let d = std::env::temp_dir().join(format!("grove-busy-{}", std::process::id()));
let _ = fs::remove_dir_all(&d);
let tmp = crate::test_tmp::TempDir::new("busy");
let d = tmp.path().join("d");
assert_eq!(busy_state(&d), BusyState::Free);
let g = BusyGuard::acquire(&d).unwrap();
assert_eq!(busy_state(&d), BusyState::Active);
+4
View File
@@ -1,5 +1,9 @@
//! Sync engine core: git plumbing wrapper, config, snapshots and state classification.
#[cfg(test)]
#[path = "../../../test-support/tmp.rs"]
mod test_tmp;
pub mod busy;
pub mod config;
pub mod git;
+2 -2
View File
@@ -218,8 +218,8 @@ mod tests {
#[test]
fn rollback_that_cannot_remove_everything_leaves_a_stage_marker() {
let d = std::env::temp_dir().join(format!("grove-rb-{}", std::process::id()));
let _ = fs::remove_dir_all(&d);
let tmp = crate::test_tmp::TempDir::new("rb");
let d = tmp.path().join("d");
let locked = d.join(".bare/locked");
fs::create_dir_all(&locked).unwrap();
fs::write(locked.join("f"), "x").unwrap();