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

Function test_line_ops_serialize_roundtrip

atomic-core/src/change/ops.rs:1517–1537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1515
1516 #[test]
1517 fn test_line_ops_serialize_roundtrip() {
1518 let ops = LineOps::insert(
1519 test_branch_id(0),
1520 Some(test_branch_id(1)),
1521 vec![
1522 LeafOp::Insert {
1523 after: None,
1524 kind: TokenKind::Word,
1525 content: b"Hello".to_vec(),
1526 },
1527 LeafOp::Delete {
1528 leaf: crate::crdt::LeafId::new(NodeId::new(1), 3),
1529 },
1530 ],
1531 );
1532
1533 let json = serde_json::to_string(&ops).unwrap();
1534 let deserialized: LineOps = serde_json::from_str(&json).unwrap();
1535
1536 assert_eq!(ops, deserialized);
1537 }
1538
1539 #[test]
1540 fn test_file_ops_postcard_roundtrip() {

Callers

nothing calls this directly

Calls 2

test_branch_idFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected