From ecfed5d7e344c617f582d1d91c7395a210a70192 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2026 11:14:56 +0000 Subject: files: a test's scratch directory goes when the test ends `scratch_dir` gives a guard (`Scratch`) that removes the directory with all it holds when dropped, the test passing or failing. Each test keeps it for as long as it uses the directory; the dashboard's browser check writes its page into one. --- src/swarm/auth.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/swarm') diff --git a/src/swarm/auth.rs b/src/swarm/auth.rs index 98a004c..7ac813b 100644 --- a/src/swarm/auth.rs +++ b/src/swarm/auth.rs @@ -166,7 +166,8 @@ mod tests { /// A swarm key file is made only when asked, then read as any other. #[test] fn swarm_key_created_only_when_asked() { - let path = crate::files::scratch_dir("swarm-key-create").join("swarm.key"); + let dir = crate::files::scratch_dir("swarm-key-create"); + let path = dir.join("swarm.key"); assert!(SwarmKey::from_file(&path, false).is_err()); assert!(!path.exists()); let created = SwarmKey::from_file(&path, true).unwrap(); -- cgit v1.3.1