diff options
| author | tv <tv@krebsco.de> | 2026-11-18 11:14:56 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-18 12:23:19 +0100 |
| commit | ecfed5d7e344c617f582d1d91c7395a210a70192 (patch) | |
| tree | b3bd6e23037220d641aa7ffb500dfa60b12ef2a7 /src/swarm | |
| parent | b6a2649f54741e88a886fe8f64e916415e8a4b72 (diff) | |
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.
Diffstat (limited to 'src/swarm')
| -rw-r--r-- | src/swarm/auth.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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(); |
