@@ -6,7 +6,10 @@ use insta::Settings;
6
6
use pretty_assertions:: assert_eq;
7
7
use rstest:: rstest;
8
8
9
- use rustic_core:: { repofile:: SnapshotFile , vfs:: Vfs , BackupOptions } ;
9
+ use rustic_core:: {
10
+ vfs:: { IdenticalSnapshot , Latest , Vfs } ,
11
+ BackupOptions , SnapshotOptions ,
12
+ } ;
10
13
use typed_path:: UnixPath ;
11
14
12
15
use super :: {
@@ -26,7 +29,8 @@ fn test_vfs(
26
29
// we use as_path to not depend on the actual tempdir
27
30
let opts = BackupOptions :: default ( ) . as_path ( PathBuf :: from_str ( "test" ) ?) ;
28
31
// 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 ( ) ?) ?;
30
34
31
35
// re-read index
32
36
let repo = repo. to_indexed ( ) ?;
@@ -54,5 +58,17 @@ fn test_vfs(
54
58
let node = vfs. node_from_path ( & repo, UnixPath :: new ( "test/0/tests/empty-file" ) ) ?;
55
59
let file = repo. open_file ( & node) ?;
56
60
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) ;
57
73
Ok ( ( ) )
58
74
}
0 commit comments