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

Function test_tree_operations

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

Source from the content-addressed store, hash-verified

264
265 #[test]
266 fn test_tree_operations() {
267 let dir = tempdir().unwrap();
268 let db_path = dir.path().join("pristine");
269 let pristine = Pristine::open(&db_path).unwrap();
270
271 let mut txn = pristine.write_txn().unwrap();
272
273 let inode = txn.alloc_inode().unwrap();
274 txn.put_tree("src/main.rs", inode).unwrap();
275
276 assert_eq!(txn.get_inode("src/main.rs").unwrap(), Some(inode));
277 assert_eq!(
278 txn.get_path(inode).unwrap(),
279 Some("src/main.rs".to_string())
280 );
281
282 let removed = txn.del_tree("src/main.rs").unwrap();
283 assert_eq!(removed, Some(inode));
284 assert_eq!(txn.get_inode("src/main.rs").unwrap(), None);
285
286 txn.commit().unwrap();
287 }
288
289 #[test]
290 fn test_graph_operations() {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected