@@ -5,12 +5,11 @@ use std::{path::PathBuf, str::FromStr};
5
5
6
6
use anyhow:: Result ;
7
7
use globset:: Glob ;
8
- use insta:: assert_debug_snapshot;
9
8
use rstest:: rstest;
10
9
11
10
use rustic_core:: {
12
11
repofile:: { Node , SnapshotFile } ,
13
- util:: GlobMatcherExt ,
12
+ util:: { GlobMatcherExt , SerializablePath } ,
14
13
BackupOptions , FindMatches , FindNode ,
15
14
} ;
16
15
use typed_path:: UnixPath ;
@@ -37,9 +36,10 @@ fn test_find(tar_gz_testdata: Result<TestSource>, set_up_repo: Result<RepoOpen>)
37
36
assert_with_win ( "find-nodes-not-found" , not_found) ;
38
37
// test non-existing match
39
38
let glob = Glob :: new ( "not_existing" ) ?. compile_matcher ( ) ;
40
- let not_found =
39
+ let FindMatches { paths , matches , .. } =
41
40
repo. find_matching_nodes ( vec ! [ snapshot. tree] , & |path, _| glob. is_unix_match ( path) ) ?;
42
- assert_debug_snapshot ! ( "find-matching-nodes-not-found" , not_found) ;
41
+ assert ! ( paths. is_empty( ) ) ;
42
+ assert_eq ! ( matches, [ [ ] ] ) ;
43
43
44
44
// test existing path
45
45
let FindNode { matches, .. } =
@@ -52,14 +52,16 @@ fn test_find(tar_gz_testdata: Result<TestSource>, set_up_repo: Result<RepoOpen>)
52
52
} ;
53
53
let FindMatches { paths, matches, .. } =
54
54
repo. find_matching_nodes ( vec ! [ snapshot. tree] , & match_func) ?;
55
- assert_debug_snapshot ! ( "find-matching-existing" , ( paths, matches) ) ;
55
+ let paths: Vec < _ > = paths. into_iter ( ) . map ( SerializablePath ) . collect ( ) ;
56
+ assert_with_win ( "find-matching-existing" , ( paths, matches) ) ;
56
57
// test existing match
57
58
let glob = Glob :: new ( "testfile*" ) ?. compile_matcher ( ) ;
58
59
let match_func = |path : & UnixPath , _: & Node | {
59
60
glob. is_unix_match ( path) || path. file_name ( ) . is_some_and ( |f| glob. is_unix_match ( f) )
60
61
} ;
61
62
let FindMatches { paths, matches, .. } =
62
63
repo. find_matching_nodes ( vec ! [ snapshot. tree] , & match_func) ?;
63
- assert_debug_snapshot ! ( "find-matching-wildcard-existing" , ( paths, matches) ) ;
64
+ let paths: Vec < _ > = paths. into_iter ( ) . map ( SerializablePath ) . collect ( ) ;
65
+ assert_with_win ( "find-matching-wildcard-existing" , ( paths, matches) ) ;
64
66
Ok ( ( ) )
65
67
}
0 commit comments