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

Function test_remove_from_tracking

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected