@@ -26,29 +26,24 @@ fn test_copy_index() -> crate::Result<()> {
26
26
let repo_files = dir_structure ( & path) ;
27
27
let copy_files = dir_structure ( output) ;
28
28
29
- let srepo_files: Vec < _ > = repo_files. iter ( ) . flat_map ( |p| p. strip_prefix ( & path) ) . collect ( ) ;
30
- let scopy_files: Vec < _ > = copy_files. iter ( ) . flat_map ( |p| p. strip_prefix ( output) ) . collect ( ) ;
31
29
assert_eq ! (
32
- srepo_files,
33
- scopy_files,
34
- "Testing if {} and {} have the same structure" ,
35
- path. display( ) ,
36
- output. display( )
30
+ repo_files
31
+ . iter( )
32
+ . flat_map( |p| p. strip_prefix( & path) )
33
+ . collect:: <Vec <_>>( ) ,
34
+ copy_files
35
+ . iter( )
36
+ . flat_map( |p| p. strip_prefix( output) )
37
+ . collect:: <Vec <_>>( )
37
38
) ;
38
39
39
40
for ( file1, file2) in repo_files. iter ( ) . zip ( copy_files. iter ( ) ) {
40
- assert_eq ! (
41
- fs:: read( file1) ?,
42
- fs:: read( file2) ?,
43
- "Testing if the contents of {} and {} are the same" ,
44
- file1. display( ) ,
45
- file2. display( ) ,
46
- ) ;
41
+ assert_eq ! ( fs:: read( file1) ?, fs:: read( file2) ?) ;
47
42
#[ cfg( unix) ]
48
43
assert_eq ! (
49
- fs:: symlink_metadata( file1) ?. mode( ) & 0b111 << 6 ,
50
- fs:: symlink_metadata( file2) ?. mode( ) & 0b111 << 6 ,
51
- "Testing if the permissions of {} and {} are the same" ,
44
+ fs:: symlink_metadata( file1) ?. mode( ) & 0o700 ,
45
+ fs:: symlink_metadata( file2) ?. mode( ) & 0o700 ,
46
+ "Testing if the permissions (normal/executable) of {} and {} are the same" ,
52
47
file1. display( ) ,
53
48
file2. display( ) ,
54
49
) ;
@@ -76,39 +71,28 @@ fn test_copy_index_without_symlinks() -> crate::Result<()> {
76
71
let repo_files = dir_structure ( & path) ;
77
72
let copy_files = dir_structure ( output) ;
78
73
79
- let srepo_files: Vec < _ > = repo_files. iter ( ) . flat_map ( |p| p. strip_prefix ( & path) ) . collect ( ) ;
80
- let scopy_files: Vec < _ > = copy_files. iter ( ) . flat_map ( |p| p. strip_prefix ( output) ) . collect ( ) ;
81
74
assert_eq ! (
82
- srepo_files,
83
- scopy_files,
84
- "Testing if {} and {} have the same structure" ,
85
- path. display( ) ,
86
- output. display( )
75
+ repo_files
76
+ . iter( )
77
+ . flat_map( |p| p. strip_prefix( & path) )
78
+ . collect:: <Vec <_>>( ) ,
79
+ copy_files
80
+ . iter( )
81
+ . flat_map( |p| p. strip_prefix( output) )
82
+ . collect:: <Vec <_>>( )
87
83
) ;
88
84
89
85
for ( file1, file2) in repo_files. iter ( ) . zip ( copy_files. iter ( ) ) {
90
86
if file1. is_symlink ( ) {
91
- assert ! ( !file2. is_symlink( ) , "Testing if the new file is not a symlink" ) ;
92
- assert_eq ! (
93
- fs:: read( file2) ?. to_path( ) ?,
94
- fs:: read_link( file1) ?,
95
- "Testing if the {} contains the path the symlink {} is pointing to" ,
96
- file2. display( ) ,
97
- file1. display( ) ,
98
- ) ;
87
+ assert ! ( !file2. is_symlink( ) ) ;
88
+ assert_eq ! ( fs:: read( file2) ?. to_path( ) ?, fs:: read_link( file1) ?) ;
99
89
} else {
100
- assert_eq ! (
101
- fs:: read( file1) ?,
102
- fs:: read( file2) ?,
103
- "Testing if the contents of {} and {} are the same" ,
104
- file1. display( ) ,
105
- file2. display( ) ,
106
- ) ;
90
+ assert_eq ! ( fs:: read( file1) ?, fs:: read( file2) ?) ;
107
91
#[ cfg( unix) ]
108
92
assert_eq ! (
109
- fs:: symlink_metadata( file1) ?. mode( ) & 0b111 << 6 ,
110
- fs:: symlink_metadata( file2) ?. mode( ) & 0b111 << 6 ,
111
- "Testing if the permissions of {} and {} are the same" ,
93
+ fs:: symlink_metadata( file1) ?. mode( ) & 0o700 ,
94
+ fs:: symlink_metadata( file2) ?. mode( ) & 0o700 ,
95
+ "Testing if the permissions (normal/executable) of {} and {} are the same" ,
112
96
file1. display( ) ,
113
97
file2. display( ) ,
114
98
) ;
0 commit comments