()
| 681 | |
| 682 | #[test] |
| 683 | fn test_apply_move() { |
| 684 | let mut txn = MockTxn::new(); |
| 685 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 686 | let trunk_id = TrunkId::new(NodeId::new(1), 0); |
| 687 | |
| 688 | // Create |
| 689 | let create_op = TrunkOp::Create { |
| 690 | path: "old.rs".to_string(), |
| 691 | encoding: None, |
| 692 | }; |
| 693 | apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap(); |
| 694 | |
| 695 | // Move |
| 696 | let move_op = TrunkOp::Move { |
| 697 | trunk: trunk_id, |
| 698 | new_path: "new.rs".to_string(), |
| 699 | }; |
| 700 | apply_trunk_op(&mut txn, &mut context, trunk_id, &move_op).unwrap(); |
| 701 | |
| 702 | let trunk = txn.get_trunk(trunk_id).unwrap().unwrap(); |
| 703 | assert_eq!(trunk.path(), "new.rs"); |
| 704 | assert!(txn.get_trunk_by_path("old.rs").unwrap().is_none()); |
| 705 | assert_eq!(txn.get_trunk_by_path("new.rs").unwrap(), Some(trunk_id)); |
| 706 | assert_eq!(context.stats().trunks_moved(), 1); |
| 707 | } |
| 708 | |
| 709 | #[test] |
| 710 | fn test_apply_move_deleted() { |
nothing calls this directly
no test coverage detected