()
| 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 |
nothing calls this directly
no test coverage detected