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

Function test_multiple_hunks

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

Source from the content-addressed store, hash-verified

2163
2164 #[test]
2165 fn test_multiple_hunks() {
2166 let mut change = Change::empty(ChangeHeader::new("Multiple hunks"));
2167
2168 for i in 0..10 {
2169 let graph_op: GraphOp<Option<Hash>> = GraphOp::Edit {
2170 change: Atom::Insertion(Insertion {
2171 predecessors: vec![],
2172 successors: vec![],
2173 flag: EdgeFlags::BLOCK,
2174 start: ChangePosition::new(i * 10),
2175 end: ChangePosition::new((i + 1) * 10),
2176 inode: test_hash_position(0),
2177 }),
2178 local: Local::new("test.rs", i + 1),
2179 encoding: Some(Encoding::Utf8),
2180 };
2181 change.add_hunk(graph_op);
2182 }
2183
2184 let mut buffer = Vec::new();
2185 change.serialize(&mut buffer).unwrap();
2186
2187 let mut cursor = Cursor::new(buffer);
2188 let (loaded, _) = Change::deserialize(&mut cursor).unwrap();
2189
2190 assert_eq!(loaded.hunks().len(), 10);
2191 }
2192
2193 #[test]
2194 fn test_hash_stability() {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected