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

Function test_multiple_hunks

atomic-core/src/change/change.rs:1168–1194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1166
1167 #[test]
1168 fn test_multiple_hunks() {
1169 let mut change = Change::empty(ChangeHeader::new("Multiple hunks"));
1170
1171 for i in 0..10 {
1172 let graph_op: GraphOp<Option<Hash>> = GraphOp::Edit {
1173 change: Atom::Insertion(Insertion {
1174 predecessors: vec![],
1175 successors: vec![],
1176 flag: EdgeFlags::BLOCK,
1177 start: ChangePosition::new(i * 10),
1178 end: ChangePosition::new((i + 1) * 10),
1179 inode: test_hash_position(0),
1180 }),
1181 local: Local::new("test.rs", i + 1),
1182 encoding: Some(Encoding::Utf8),
1183 };
1184 change.add_hunk(graph_op);
1185 }
1186
1187 let mut buffer = Vec::new();
1188 change.serialize(&mut buffer).unwrap();
1189
1190 let mut cursor = Cursor::new(buffer);
1191 let (loaded, _) = Change::deserialize(&mut cursor).unwrap();
1192
1193 assert_eq!(loaded.hunks().len(), 10);
1194 }
1195
1196 #[test]
1197 fn test_hash_stability() {

Callers

nothing calls this directly

Calls 6

InsertionClass · 0.85
deserializeFunction · 0.85
test_hash_positionFunction · 0.70
add_hunkMethod · 0.45
unwrapMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected