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

Source from the content-addressed store, hash-verified

1156
1157 #[test]
1158 fn test_file_ops_serialize_roundtrip() {
1159 let mut ops = FileOps::create(
1160 test_trunk_id(),
1161 "test.txt".to_string(),
1162 Some(Encoding::Utf8),
1163 );
1164 ops.add_line_op(LineOps::insert(
1165 test_branch_id(0),
1166 None,
1167 vec![LeafOp::Insert {
1168 after: None,
1169 kind: TokenKind::Word,
1170 content: b"Hello".to_vec(),
1171 }],
1172 ));
1173
1174 let json = serde_json::to_string(&ops).unwrap();
1175 let deserialized: FileOps = serde_json::from_str(&json).unwrap();
1176
1177 assert_eq!(ops, deserialized);
1178 }
1179
1180 #[test]
1181 fn test_line_ops_serialize_roundtrip() {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected