| 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() { |