Skip to content

Commit f4c46cd

Browse files
committed
more tests
1 parent 599a840 commit f4c46cd

File tree

1 file changed

+18
-2
lines changed
  • crates/core/tests/integration

1 file changed

+18
-2
lines changed

crates/core/tests/integration/vfs.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ use insta::Settings;
66
use pretty_assertions::assert_eq;
77
use rstest::rstest;
88

9-
use rustic_core::{repofile::SnapshotFile, vfs::Vfs, BackupOptions};
9+
use rustic_core::{
10+
vfs::{IdenticalSnapshot, Latest, Vfs},
11+
BackupOptions, SnapshotOptions,
12+
};
1013
use typed_path::UnixPath;
1114

1215
use super::{
@@ -26,7 +29,8 @@ fn test_vfs(
2629
// we use as_path to not depend on the actual tempdir
2730
let opts = BackupOptions::default().as_path(PathBuf::from_str("test")?);
2831
// backup test-data
29-
let snapshot = repo.backup(&opts, paths, SnapshotFile::default())?;
32+
let snap_opts = SnapshotOptions::default().label("label".to_string());
33+
let snapshot = repo.backup(&opts, paths, snap_opts.to_snapshot()?)?;
3034

3135
// re-read index
3236
let repo = repo.to_indexed()?;
@@ -54,5 +58,17 @@ fn test_vfs(
5458
let node = vfs.node_from_path(&repo, UnixPath::new("test/0/tests/empty-file"))?;
5559
let file = repo.open_file(&node)?;
5660
assert_eq!(Bytes::new(), repo.read_file_at(&file, 0, 0)?); // empty files
61+
62+
// create Vfs from snapshots
63+
let vfs = Vfs::from_snapshots(
64+
vec![snapshot],
65+
"{label}/{time}",
66+
"%Y",
67+
Latest::AsDir,
68+
IdenticalSnapshot::AsLink,
69+
)?;
70+
let entries_from_snapshots =
71+
vfs.dir_entries_from_path(&repo, UnixPath::new("label/latest/test/0/tests"))?;
72+
assert_eq!(entries_from_snapshots, entries);
5773
Ok(())
5874
}

0 commit comments

Comments
 (0)