Skip to content

Commit

Permalink
test: add test_delete_with_finder_osakit_with_info
Browse files Browse the repository at this point in the history
disabled as it can timeout
  • Loading branch information
eugenesvk committed Dec 8, 2024
1 parent b55ddca commit 4e5c6e6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/macos/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,43 @@ fn test_delete_with_finder_with_info() {
assert!(File::open(&trashed_path).is_err()); // cleaned up trash items
}

/*
#[test]
#[serial]
fn test_delete_with_finder_osakit_with_info() { // tested to work, but not always: can randomly timeout, so disabled by default
init_logging();
let mut trash_ctx = TrashContext::default();
trash_ctx.set_delete_method(DeleteMethod::Finder);
trash_ctx.set_script_method(ScriptMethod::Osakit);
let mut path1 = PathBuf::from(get_unique_name());
let mut path2 = PathBuf::from(get_unique_name());
path1.set_extension(r#"a"b,"#);
path2.set_extension(r#"x80=%80 slash=\ pc=% quote=" comma=,"#);
File::create_new(&path1).unwrap();
File::create_new(&path2).unwrap();
let trashed_items = trash_ctx.delete_all_with_info(&[path1.clone(), path2.clone()]).unwrap().unwrap(); //Ok + Some trashed paths
assert!(File::open(&path1).is_err()); // original files deleted
assert!(File::open(&path2).is_err());
for item in trashed_items {
let trashed_path = item.id;
assert!(!File::open(&trashed_path).is_err()); // returned trash items exist
std::fs::remove_file(&trashed_path).unwrap(); // clean up
assert!(File::open(&trashed_path).is_err()); // cleaned up trash items
}
// test a single file (in case returned paths aren't an array anymore)
let mut path3 = PathBuf::from(get_unique_name());
path3.set_extension(r#"a"b,"#);
File::create_new(&path3).unwrap();
let item = trash_ctx.delete_with_info(&path3).unwrap().unwrap(); //Ok + Some trashed paths
assert!(File::open(&path3).is_err()); // original files deleted
let trashed_path = item.id;
assert!(!File::open(&trashed_path).is_err()); // returned trash items exist
std::fs::remove_file(&trashed_path).unwrap(); // clean up
assert!(File::open(&trashed_path).is_err()); // cleaned up trash items
}*/

#[test]
#[serial]
fn test_delete_binary_with_finder_with_info() {
Expand Down

0 comments on commit 4e5c6e6

Please sign in to comment.