| 459 | |
| 460 | #[test] |
| 461 | fn test_add_and_check_tracked() { |
| 462 | use atomic_core::pristine::Pristine; |
| 463 | use tempfile::TempDir; |
| 464 | |
| 465 | let temp_dir = TempDir::new().unwrap(); |
| 466 | let db_path = temp_dir.path().join("pristine.redb"); |
| 467 | |
| 468 | let pristine = Pristine::open(&db_path).unwrap(); |
| 469 | |
| 470 | // Add a file to tracking |
| 471 | { |
| 472 | let mut txn = pristine.write_txn().unwrap(); |
| 473 | let inode = add_to_tree(&mut txn, "src/main.rs", false).unwrap(); |
| 474 | assert!(inode.get() > 0); |
| 475 | txn.commit().unwrap(); |
| 476 | } |
| 477 | |
| 478 | // Check it's tracked |
| 479 | { |
| 480 | let txn = pristine.read_txn().unwrap(); |
| 481 | assert!(is_tracked(&txn, "src/main.rs").unwrap()); |
| 482 | assert!(!is_tracked(&txn, "nonexistent.rs").unwrap()); |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | #[test] |
| 487 | fn test_add_and_get_inode() { |