diff options
Diffstat (limited to 'tests/src/tests.rs')
| -rw-r--r-- | tests/src/tests.rs | 21 |
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()); + } + } + } + } +} |
