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

Function test_apply_move_deleted

atomic-core/src/crdt/apply/trunk.rs:710–734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

708
709 #[test]
710 fn test_apply_move_deleted() {
711 let mut txn = MockTxn::new();
712 let mut context = ApplyContext::new(ApplyOptions::default());
713 let trunk_id = TrunkId::new(NodeId::new(1), 0);
714
715 // Create and delete
716 let create_op = TrunkOp::Create {
717 path: "test.rs".to_string(),
718 encoding: None,
719 };
720 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
721
722 let delete_op = TrunkOp::Delete { trunk: trunk_id };
723 apply_trunk_op(&mut txn, &mut context, trunk_id, &delete_op).unwrap();
724
725 // Try to move
726 let move_op = TrunkOp::Move {
727 trunk: trunk_id,
728 new_path: "new.rs".to_string(),
729 };
730 let result = apply_trunk_op(&mut txn, &mut context, trunk_id, &move_op);
731
732 assert!(result.is_err());
733 assert!(result.unwrap_err().is_invalid_state());
734 }
735
736 #[test]
737 fn test_apply_move_path_collision() {

Callers

nothing calls this directly

Calls 2

apply_trunk_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected