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

Function test_apply_create_path_collision

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

Source from the content-addressed store, hash-verified

602
603 #[test]
604 fn test_apply_create_path_collision() {
605 let mut txn = MockTxn::new();
606 let mut context = ApplyContext::new(ApplyOptions::default());
607
608 let trunk_id1 = TrunkId::new(NodeId::new(1), 0);
609 let trunk_id2 = TrunkId::new(NodeId::new(2), 0);
610
611 let op1 = TrunkOp::Create {
612 path: "test.rs".to_string(),
613 encoding: None,
614 };
615 apply_trunk_op(&mut txn, &mut context, trunk_id1, &op1).unwrap();
616
617 // Try to create another file at same path
618 let op2 = TrunkOp::Create {
619 path: "test.rs".to_string(),
620 encoding: None,
621 };
622
623 let result = apply_trunk_op(&mut txn, &mut context, trunk_id2, &op2);
624 assert!(result.is_err());
625 assert!(result.unwrap_err().is_already_exists());
626 }
627
628 // Delete Tests
629

Callers

nothing calls this directly

Calls 2

apply_trunk_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected