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:1714–1734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1712
1713 #[test]
1714 fn test_file_ops_serialize_roundtrip() {
1715 let mut ops = FileOps::create(
1716 test_trunk_id(),
1717 "test.txt".to_string(),
1718 Some(Encoding::Utf8),
1719 );
1720 ops.add_line_op(LineOps::insert(
1721 test_branch_id(0),
1722 None,
1723 vec![LeafOp::Insert {
1724 after: None,
1725 kind: TokenKind::Word,
1726 content: b"Hello".to_vec(),
1727 }],
1728 ));
1729
1730 let json = serde_json::to_string(&ops).unwrap();
1731 let deserialized: FileOps = serde_json::from_str(&json).unwrap();
1732
1733 assert_eq!(ops, deserialized);
1734 }
1735
1736 #[test]
1737 fn test_line_ops_serialize_roundtrip() {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected