()
| 632 | |
| 633 | #[test] |
| 634 | fn test_apply_insert() { |
| 635 | let mut txn = MockTxn::new(); |
| 636 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 637 | let branch_id = create_test_branch(&mut txn, 1, 0); |
| 638 | let leaf_id = LeafId::new(NodeId::new(1), 0); |
| 639 | |
| 640 | let op = LeafOp::Insert { |
| 641 | after: None, |
| 642 | kind: TokenKind::Word, |
| 643 | content: b"hello".to_vec(), |
| 644 | }; |
| 645 | |
| 646 | apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &op, b"hello").unwrap(); |
| 647 | |
| 648 | assert!(txn.has_leaf(leaf_id).unwrap()); |
| 649 | let leaf = txn.get_leaf(leaf_id).unwrap().unwrap(); |
| 650 | assert_eq!(leaf.branch(), branch_id); |
| 651 | assert_eq!(leaf.kind(), TokenKind::Word); |
| 652 | assert!(leaf.state().is_alive()); |
| 653 | assert_eq!(context.stats().leaves_inserted(), 1); |
| 654 | } |
| 655 | |
| 656 | #[test] |
| 657 | fn test_apply_insert_after() { |
nothing calls this directly
no test coverage detected