()
| 515 | |
| 516 | #[test] |
| 517 | fn test_remove_from_tracking() { |
| 518 | use atomic_core::pristine::Pristine; |
| 519 | use tempfile::TempDir; |
| 520 | |
| 521 | let temp_dir = TempDir::new().unwrap(); |
| 522 | let db_path = temp_dir.path().join("pristine.redb"); |
| 523 | |
| 524 | let pristine = Pristine::open(&db_path).unwrap(); |
| 525 | |
| 526 | // Add and then remove |
| 527 | { |
| 528 | let mut txn = pristine.write_txn().unwrap(); |
| 529 | add_to_tree(&mut txn, "to_remove.txt", false).unwrap(); |
| 530 | txn.commit().unwrap(); |
| 531 | } |
| 532 | |
| 533 | // Verify it's tracked |
| 534 | { |
| 535 | let txn = pristine.read_txn().unwrap(); |
| 536 | assert!(is_tracked(&txn, "to_remove.txt").unwrap()); |
| 537 | } |
| 538 | |
| 539 | // Remove it |
| 540 | { |
| 541 | let mut txn = pristine.write_txn().unwrap(); |
| 542 | let removed = remove_from_tree(&mut txn, "to_remove.txt").unwrap(); |
| 543 | assert!(removed.is_some()); |
| 544 | txn.commit().unwrap(); |
| 545 | } |
| 546 | |
| 547 | // Verify it's gone |
| 548 | { |
| 549 | let txn = pristine.read_txn().unwrap(); |
| 550 | assert!(!is_tracked(&txn, "to_remove.txt").unwrap()); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | #[test] |
| 555 | fn test_move_tracked_file() { |
nothing calls this directly
no test coverage detected