MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_line_content

Function test_line_content

atomic-core/src/output/crdt.rs:680–710  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

678
679 #[test]
680 fn test_line_content() {
681 let id = BranchId::new(crate::types::NodeId::new(1), 0);
682 let mut line = Line::new(id, 1, BranchState::Alive, 0);
683
684 let leaf_id = LeafId::new(crate::types::NodeId::new(1), 0);
685 line.add_token(Token::new(
686 leaf_id,
687 TokenKind::Word,
688 b"hello".to_vec(),
689 LeafState::Alive,
690 ));
691
692 let leaf_id2 = LeafId::new(crate::types::NodeId::new(1), 1);
693 line.add_token(Token::new(
694 leaf_id2,
695 TokenKind::Whitespace,
696 b" ".to_vec(),
697 LeafState::Alive,
698 ));
699
700 let leaf_id3 = LeafId::new(crate::types::NodeId::new(1), 2);
701 line.add_token(Token::new(
702 leaf_id3,
703 TokenKind::Word,
704 b"world".to_vec(),
705 LeafState::Alive,
706 ));
707
708 assert_eq!(line.content(), "hello world");
709 assert_eq!(line.token_count(), 3);
710 }
711
712 #[test]
713 fn test_line_with_deleted_tokens() {

Callers

nothing calls this directly

Calls 1

add_tokenMethod · 0.45

Tested by

no test coverage detected