()
| 655 | |
| 656 | #[test] |
| 657 | fn test_apply_insert_after() { |
| 658 | let mut txn = MockTxn::new(); |
| 659 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 660 | let branch_id = create_test_branch(&mut txn, 1, 0); |
| 661 | |
| 662 | let leaf_id1 = LeafId::new(NodeId::new(1), 0); |
| 663 | let leaf_id2 = LeafId::new(NodeId::new(1), 1); |
| 664 | |
| 665 | // Insert first leaf |
| 666 | let op1 = LeafOp::Insert { |
| 667 | after: None, |
| 668 | kind: TokenKind::Word, |
| 669 | content: b"hello".to_vec(), |
| 670 | }; |
| 671 | apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id1, &op1, b"hello").unwrap(); |
| 672 | |
| 673 | // Insert second leaf after first |
| 674 | let op2 = LeafOp::Insert { |
| 675 | after: Some(leaf_id1), |
| 676 | kind: TokenKind::Whitespace, |
| 677 | content: b" ".to_vec(), |
| 678 | }; |
| 679 | apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id2, &op2, b" ").unwrap(); |
| 680 | |
| 681 | assert!(txn.has_leaf(leaf_id1).unwrap()); |
| 682 | assert!(txn.has_leaf(leaf_id2).unwrap()); |
| 683 | assert_eq!(context.stats().leaves_inserted(), 2); |
| 684 | } |
| 685 | |
| 686 | #[test] |
| 687 | fn test_apply_insert_duplicate_id() { |
nothing calls this directly
no test coverage detected