()
| 792 | |
| 793 | #[test] |
| 794 | fn test_apply_delete_already_deleted() { |
| 795 | let mut txn = MockTxn::new(); |
| 796 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 797 | let branch_id = create_test_branch(&mut txn, 1, 0); |
| 798 | let leaf_id = LeafId::new(NodeId::new(1), 0); |
| 799 | |
| 800 | // Create and delete |
| 801 | let insert_op = LeafOp::Insert { |
| 802 | after: None, |
| 803 | kind: TokenKind::Word, |
| 804 | content: b"hello".to_vec(), |
| 805 | }; |
| 806 | apply_leaf_op( |
| 807 | &mut txn, |
| 808 | &mut context, |
| 809 | branch_id, |
| 810 | leaf_id, |
| 811 | &insert_op, |
| 812 | b"hello", |
| 813 | ) |
| 814 | .unwrap(); |
| 815 | |
| 816 | let delete_op = LeafOp::Delete { leaf: leaf_id }; |
| 817 | apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &delete_op, &[]).unwrap(); |
| 818 | |
| 819 | // Try to delete again |
| 820 | let result = apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &delete_op, &[]); |
| 821 | assert!(result.is_err()); |
| 822 | assert!(result.unwrap_err().is_invalid_state()); |
| 823 | } |
| 824 | |
| 825 | // Replace Tests |
| 826 |
nothing calls this directly
no test coverage detected