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