summaryrefslogtreecommitdiff
path: root/tests/src/tests.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-09-16 16:41:18 +0200
committerGitHub <noreply@github.com>2024-09-16 14:41:18 +0000
commit16e67f8bea7e6891e954420e2e005976fb48a528 (patch)
treeb1de8e17f184d10894447a602da1722a71dd23a9 /tests/src/tests.rs
parentdb71a178bef7f1525d732a190ac75a1a6d56f24b (diff)
Shrink tests (#4967)
Diffstat (limited to 'tests/src/tests.rs')
-rw-r--r--tests/src/tests.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index 8558abb6..a2d85fec 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -38,7 +38,8 @@ fn main() {
match &ARGS.command {
None => test(),
- Some(Command::Clean) => std::fs::remove_dir_all(STORE_PATH).unwrap(),
+ Some(Command::Clean) => clean(),
+ Some(Command::Undangle) => undangle(),
}
}
@@ -120,3 +121,21 @@ fn test() {
std::process::exit(1);
}
}
+
+fn clean() {
+ std::fs::remove_dir_all(STORE_PATH).unwrap();
+}
+
+fn undangle() {
+ match crate::collect::collect() {
+ Ok(_) => eprintln!("no danging reference images"),
+ Err(errors) => {
+ for error in errors {
+ if error.message == "dangling reference image" {
+ std::fs::remove_file(&error.pos.path).unwrap();
+ eprintln!("✅ deleted {}", error.pos.path.display());
+ }
+ }
+ }
+ }
+}