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

Function test_directory_del

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

Source from the content-addressed store, hash-verified

825
826 #[test]
827 fn test_directory_del() {
828 let dir = tempdir().unwrap();
829 let db_path = dir.path().join("pristine");
830 let pristine = Pristine::open(&db_path).unwrap();
831
832 let mut txn = pristine.write_txn().unwrap();
833 let inode = txn.alloc_inode().unwrap();
834
835 use crate::pristine::tables::directory_flags;
836 txn.put_directory(inode, directory_flags::DIR_EXPLICIT)
837 .unwrap();
838
839 // Delete the directory marker
840 let old_flags = txn.del_directory(inode).unwrap();
841 assert_eq!(old_flags, Some(directory_flags::DIR_EXPLICIT));
842
843 // No longer a directory
844 assert!(!TreeTxnT::is_directory(&txn, inode).unwrap());
845
846 txn.commit().unwrap();
847 }
848
849 #[test]
850 fn test_directory_update_flags() {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected