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

Function test_directory_del

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

Source from the content-addressed store, hash-verified

694
695 #[test]
696 fn test_directory_del() {
697 let dir = tempdir().unwrap();
698 let db_path = dir.path().join("pristine");
699 let pristine = Pristine::open(&db_path).unwrap();
700
701 let mut txn = pristine.write_txn().unwrap();
702 let inode = txn.alloc_inode().unwrap();
703
704 use crate::pristine::tables::directory_flags;
705 txn.put_directory(inode, directory_flags::DIR_EXPLICIT)
706 .unwrap();
707
708 // Delete the directory marker
709 let old_flags = txn.del_directory(inode).unwrap();
710 assert_eq!(old_flags, Some(directory_flags::DIR_EXPLICIT));
711
712 // No longer a directory
713 assert!(!TreeTxnT::is_directory(&txn, inode).unwrap());
714
715 txn.commit().unwrap();
716 }
717
718 #[test]
719 fn test_directory_update_flags() {

Callers

nothing calls this directly

Calls 7

write_txnMethod · 0.80
put_directoryMethod · 0.80
del_directoryMethod · 0.80
commitMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
alloc_inodeMethod · 0.45

Tested by

no test coverage detected