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

Function test_file_ops_serialize_roundtrip

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

Source from the content-addressed store, hash-verified

1492
1493 #[test]
1494 fn test_file_ops_serialize_roundtrip() {
1495 let mut ops = FileOps::create(
1496 test_trunk_id(),
1497 "test.txt".to_string(),
1498 Some(Encoding::Utf8),
1499 );
1500 ops.add_line_op(LineOps::insert(
1501 test_branch_id(0),
1502 None,
1503 vec![LeafOp::Insert {
1504 after: None,
1505 kind: TokenKind::Word,
1506 content: b"Hello".to_vec(),
1507 }],
1508 ));
1509
1510 let json = serde_json::to_string(&ops).unwrap();
1511 let deserialized: FileOps = serde_json::from_str(&json).unwrap();
1512
1513 assert_eq!(ops, deserialized);
1514 }
1515
1516 #[test]
1517 fn test_line_ops_serialize_roundtrip() {

Callers

nothing calls this directly

Calls 5

test_branch_idFunction · 0.85
test_trunk_idFunction · 0.70
createFunction · 0.50
add_line_opMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected