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

Function test_add_and_get_inode

atomic-repository/src/tracking/tests.rs:490–514  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

488
489#[test]
490fn test_add_and_get_inode() {
491 use atomic_core::pristine::Pristine;
492 use tempfile::TempDir;
493
494 let temp_dir = TempDir::new().unwrap();
495 let db_path = temp_dir.path().join("pristine.redb");
496
497 let pristine = Pristine::open(&db_path).unwrap();
498
499 let expected_inode;
500
501 // Add a file
502 {
503 let mut txn = pristine.write_txn().unwrap();
504 expected_inode = add_to_tree(&mut txn, "test.txt", false).unwrap();
505 txn.commit().unwrap();
506 }
507
508 // Get the inode back
509 {
510 let txn = pristine.read_txn().unwrap();
511 let inode = get_inode(&txn, "test.txt").unwrap();
512 assert_eq!(inode, Some(expected_inode));
513 }
514}
515
516#[test]
517fn test_remove_from_tracking() {

Callers

nothing calls this directly

Calls 8

openFunction · 0.85
add_to_treeFunction · 0.85
get_inodeFunction · 0.85
write_txnMethod · 0.80
read_txnMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected