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

Function test_remove_from_tracking

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

openFunction · 0.85
add_to_treeFunction · 0.85
remove_from_treeFunction · 0.85
write_txnMethod · 0.80
read_txnMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected