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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

apply_trunk_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected