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

Function test_line_content

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

Source from the content-addressed store, hash-verified

645
646 #[test]
647 fn test_line_content() {
648 let id = BranchId::new(crate::types::NodeId::new(1), 0);
649 let mut line = Line::new(id, 1, BranchState::Alive, 0);
650
651 let leaf_id = LeafId::new(crate::types::NodeId::new(1), 0);
652 line.add_token(Token::new(
653 leaf_id,
654 TokenKind::Word,
655 b"hello".to_vec(),
656 LeafState::Alive,
657 ));
658
659 let leaf_id2 = LeafId::new(crate::types::NodeId::new(1), 1);
660 line.add_token(Token::new(
661 leaf_id2,
662 TokenKind::Whitespace,
663 b" ".to_vec(),
664 LeafState::Alive,
665 ));
666
667 let leaf_id3 = LeafId::new(crate::types::NodeId::new(1), 2);
668 line.add_token(Token::new(
669 leaf_id3,
670 TokenKind::Word,
671 b"world".to_vec(),
672 LeafState::Alive,
673 ));
674
675 assert_eq!(line.content(), "hello world");
676 assert_eq!(line.token_count(), 3);
677 }
678
679 #[test]
680 fn test_line_with_deleted_tokens() {

Callers

nothing calls this directly

Calls 1

add_tokenMethod · 0.45

Tested by

no test coverage detected