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

Function test_list_tracked_files

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

Source from the content-addressed store, hash-verified

592
593#[test]
594fn 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]
630fn test_tracked_under_prefix() {

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected