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

Function test_line_content

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

Source from the content-addressed store, hash-verified

621
622 #[test]
623 fn test_line_content() {
624 let id = BranchId::new(crate::types::NodeId::new(1), 0);
625 let mut line = Line::new(id, 1, BranchState::Alive, 0);
626
627 let leaf_id = LeafId::new(crate::types::NodeId::new(1), 0);
628 line.add_token(Token::new(
629 leaf_id,
630 TokenKind::Word,
631 b"hello".to_vec(),
632 LeafState::Alive,
633 ));
634
635 let leaf_id2 = LeafId::new(crate::types::NodeId::new(1), 1);
636 line.add_token(Token::new(
637 leaf_id2,
638 TokenKind::Whitespace,
639 b" ".to_vec(),
640 LeafState::Alive,
641 ));
642
643 let leaf_id3 = LeafId::new(crate::types::NodeId::new(1), 2);
644 line.add_token(Token::new(
645 leaf_id3,
646 TokenKind::Word,
647 b"world".to_vec(),
648 LeafState::Alive,
649 ));
650
651 assert_eq!(line.content(), "hello world");
652 assert_eq!(line.token_count(), 3);
653 }
654
655 #[test]
656 fn test_line_with_deleted_tokens() {

Callers

nothing calls this directly

Calls 1

add_tokenMethod · 0.45

Tested by

no test coverage detected