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

Function test_tree_operations

atomic-core/src/pristine/txn/write/tests.rs:349–370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

347
348 #[test]
349 fn test_tree_operations() {
350 let dir = tempdir().unwrap();
351 let db_path = dir.path().join("pristine");
352 let pristine = Pristine::open(&db_path).unwrap();
353
354 let mut txn = pristine.write_txn().unwrap();
355
356 let inode = txn.alloc_inode().unwrap();
357 txn.put_tree("src/main.rs", inode).unwrap();
358
359 assert_eq!(txn.get_inode("src/main.rs").unwrap(), Some(inode));
360 assert_eq!(
361 txn.get_path(inode).unwrap(),
362 Some("src/main.rs".to_string())
363 );
364
365 let removed = txn.del_tree("src/main.rs").unwrap();
366 assert_eq!(removed, Some(inode));
367 assert_eq!(txn.get_inode("src/main.rs").unwrap(), None);
368
369 txn.commit().unwrap();
370 }
371
372 #[test]
373 fn test_del_tree_binding_preserves_other_same_path_occupant() {

Callers

nothing calls this directly

Calls 8

openFunction · 0.85
write_txnMethod · 0.80
put_treeMethod · 0.80
del_treeMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
alloc_inodeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected