MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_list_tracked_files

Function test_list_tracked_files

atomic-repository/src/tracking/tests.rs:591–624  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

589
590#[test]
591fn 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]
627fn test_tracked_under_prefix() {

Callers

nothing calls this directly

Calls 8

add_to_treeFunction · 0.85
list_trackedFunction · 0.85
write_txnMethod · 0.80
commitMethod · 0.80
read_txnMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected