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