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

Source from the content-addressed store, hash-verified

715
716 #[test]
717 fn test_apply_move_deleted() {
718 let mut txn = MockTxn::new();
719 let mut context = ApplyContext::new(ApplyOptions::default());
720 let trunk_id = TrunkId::new(NodeId::new(1), 0);
721
722 // Create and delete
723 let create_op = TrunkOp::Create {
724 path: "test.rs".to_string(),
725 encoding: None,
726 };
727 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
728
729 let delete_op = TrunkOp::Delete { trunk: trunk_id };
730 apply_trunk_op(&mut txn, &mut context, trunk_id, &delete_op).unwrap();
731
732 // Try to move
733 let move_op = TrunkOp::Move {
734 trunk: trunk_id,
735 new_path: "new.rs".to_string(),
736 };
737 let result = apply_trunk_op(&mut txn, &mut context, trunk_id, &move_op);
738
739 assert!(result.is_err());
740 assert!(result.unwrap_err().is_invalid_state());
741 }
742
743 #[test]
744 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