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

Function test_deletion_preserves_id

atomic-core/src/crdt/mod.rs:264–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262
263 #[test]
264 fn test_deletion_preserves_id() {
265 let change_id = NodeId::new(1);
266 let mut leaf = Leaf::new(
267 LeafId::new(change_id, 0),
268 BranchId::new(change_id, 0),
269 TokenKind::Word,
270 0..5,
271 );
272
273 let original_id = leaf.id();
274
275 // Delete the leaf
276 leaf.delete();
277 assert!(leaf.state().is_deleted());
278
279 // ID is preserved
280 assert_eq!(leaf.id(), original_id);
281
282 // Can be restored
283 leaf.restore();
284 assert!(leaf.state().is_alive());
285 assert_eq!(leaf.id(), original_id);
286 }
287
288 #[test]
289 fn test_replace_preserves_id_for_blame() {

Callers

nothing calls this directly

Calls 3

idMethod · 0.45
deleteMethod · 0.45
restoreMethod · 0.45

Tested by

no test coverage detected