diff options
Diffstat (limited to 'src/generation.rs')
-rw-r--r-- | src/generation.rs | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/generation.rs b/src/generation.rs index cec3d14..477edc0 100644 --- a/src/generation.rs +++ b/src/generation.rs @@ -297,33 +297,22 @@ impl LocalGeneration { #[cfg(test)] mod test { use super::{LabelChecksumKind, LocalGeneration, NascentGeneration, Reason, SchemaVersion}; - use crate::fsentry::FilesystemEntry; + use crate::fsentry::EntryBuilder; use crate::fsentry::FilesystemKind; - use std::path::Path; + use std::path::PathBuf; use tempfile::{tempdir, NamedTempFile}; - use users::UsersCache; #[test] fn round_trips_u64_max() { let tmp = tempdir().unwrap(); let filename = tmp.path().join("test.db"); - let mut cache = UsersCache::new(); + let path = PathBuf::from("/"); let schema = SchemaVersion::new(0, 0); { - let e = FilesystemEntry::new( - Path::new("/"), - FilesystemKind::Directory, - 0, - 0, - u64::MAX, - 0, - 0, - 0, - 0, - 0, - &mut cache, - ) - .unwrap(); + let e = EntryBuilder::new(FilesystemKind::Directory) + .path(path.clone()) + .len(u64::MAX) + .build(); let mut gen = NascentGeneration::create(&filename, schema, LabelChecksumKind::Sha256).unwrap(); gen.insert(e, &[], Reason::IsNew, false).unwrap(); @@ -331,7 +320,7 @@ mod test { } let db = LocalGeneration::open(&filename).unwrap(); - let e = db.get_file(Path::new("/")).unwrap().unwrap(); + let e = db.get_file(&path).unwrap().unwrap(); assert_eq!(e.len(), u64::MAX); } |