()
| 742 | |
| 743 | #[test] |
| 744 | fn test_apply_move_path_collision() { |
| 745 | let mut txn = MockTxn::new(); |
| 746 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 747 | |
| 748 | let trunk_id1 = TrunkId::new(NodeId::new(1), 0); |
| 749 | let trunk_id2 = TrunkId::new(NodeId::new(2), 0); |
| 750 | |
| 751 | // Create two files |
| 752 | let create1 = TrunkOp::Create { |
| 753 | path: "file1.rs".to_string(), |
| 754 | encoding: None, |
| 755 | }; |
| 756 | let create2 = TrunkOp::Create { |
| 757 | path: "file2.rs".to_string(), |
| 758 | encoding: None, |
| 759 | }; |
| 760 | apply_trunk_op(&mut txn, &mut context, trunk_id1, &create1).unwrap(); |
| 761 | apply_trunk_op(&mut txn, &mut context, trunk_id2, &create2).unwrap(); |
| 762 | |
| 763 | // Try to move file1 to file2's path |
| 764 | let move_op = TrunkOp::Move { |
| 765 | trunk: trunk_id1, |
| 766 | new_path: "file2.rs".to_string(), |
| 767 | }; |
| 768 | let result = apply_trunk_op(&mut txn, &mut context, trunk_id1, &move_op); |
| 769 | |
| 770 | assert!(result.is_err()); |
| 771 | assert!(result.unwrap_err().is_already_exists()); |
| 772 | } |
| 773 | |
| 774 | #[test] |
| 775 | fn test_apply_move_same_path() { |
nothing calls this directly
no test coverage detected