| 347 | |
| 348 | #[test] |
| 349 | fn test_tree_operations() { |
| 350 | let dir = tempdir().unwrap(); |
| 351 | let db_path = dir.path().join("pristine"); |
| 352 | let pristine = Pristine::open(&db_path).unwrap(); |
| 353 | |
| 354 | let mut txn = pristine.write_txn().unwrap(); |
| 355 | |
| 356 | let inode = txn.alloc_inode().unwrap(); |
| 357 | txn.put_tree("src/main.rs", inode).unwrap(); |
| 358 | |
| 359 | assert_eq!(txn.get_inode("src/main.rs").unwrap(), Some(inode)); |
| 360 | assert_eq!( |
| 361 | txn.get_path(inode).unwrap(), |
| 362 | Some("src/main.rs".to_string()) |
| 363 | ); |
| 364 | |
| 365 | let removed = txn.del_tree("src/main.rs").unwrap(); |
| 366 | assert_eq!(removed, Some(inode)); |
| 367 | assert_eq!(txn.get_inode("src/main.rs").unwrap(), None); |
| 368 | |
| 369 | txn.commit().unwrap(); |
| 370 | } |
| 371 | |
| 372 | #[test] |
| 373 | fn test_del_tree_binding_preserves_other_same_path_occupant() { |