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:661–688  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected