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

Function test_move_to_existing_fails

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

Source from the content-addressed store, hash-verified

656
657#[test]
658fn test_move_to_existing_fails() {
659 use atomic_core::pristine::Pristine;
660 use tempfile::TempDir;
661
662 let temp_dir = TempDir::new().unwrap();
663 let db_path = temp_dir.path().join("pristine.redb");
664
665 let pristine = Pristine::open(&db_path).unwrap();
666
667 // Add two files
668 {
669 let mut txn = pristine.write_txn().unwrap();
670 add_to_tree(&mut txn, "file1.txt", false).unwrap();
671 add_to_tree(&mut txn, "file2.txt", false).unwrap();
672 txn.commit().unwrap();
673 }
674
675 // Try to move file1 to file2 (should fail)
676 {
677 let mut txn = pristine.write_txn().unwrap();
678 let result = move_tracked(&mut txn, "file1.txt", "file2.txt");
679 assert!(result.is_err());
680 assert!(matches!(
681 result.unwrap_err(),
682 TrackingError::DestinationExists { .. }
683 ));
684 }
685}
686
687#[test]
688fn test_move_nonexistent_fails() {

Callers

nothing calls this directly

Calls 6

add_to_treeFunction · 0.85
move_trackedFunction · 0.85
write_txnMethod · 0.80
commitMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected