()
| 592 | |
| 593 | #[test] |
| 594 | fn test_list_tracked_files() { |
| 595 | use atomic_core::pristine::Pristine; |
| 596 | use tempfile::TempDir; |
| 597 | |
| 598 | let temp_dir = TempDir::new().unwrap(); |
| 599 | let db_path = temp_dir.path().join("pristine.redb"); |
| 600 | |
| 601 | let pristine = Pristine::open(&db_path).unwrap(); |
| 602 | |
| 603 | // Add multiple files |
| 604 | { |
| 605 | let mut txn = pristine.write_txn().unwrap(); |
| 606 | add_to_tree(&mut txn, "file1.txt", false).unwrap(); |
| 607 | add_to_tree(&mut txn, "file2.txt", false).unwrap(); |
| 608 | add_to_tree(&mut txn, "src/main.rs", false).unwrap(); |
| 609 | txn.commit().unwrap(); |
| 610 | } |
| 611 | |
| 612 | // List them |
| 613 | { |
| 614 | let txn = pristine.read_txn().unwrap(); |
| 615 | let tracked: Vec<TrackedFile> = list_tracked(&txn).unwrap(); |
| 616 | |
| 617 | assert_eq!(tracked.len(), 3); |
| 618 | |
| 619 | let paths: Vec<_> = tracked |
| 620 | .iter() |
| 621 | .map(|f| f.path.to_string_lossy().to_string()) |
| 622 | .collect(); |
| 623 | assert!(paths.contains(&"file1.txt".to_string())); |
| 624 | assert!(paths.contains(&"file2.txt".to_string())); |
| 625 | assert!(paths.contains(&"src/main.rs".to_string())); |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | #[test] |
| 630 | fn test_tracked_under_prefix() { |
nothing calls this directly
no test coverage detected