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