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:487–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected