@@ -26,29 +26,24 @@ fn test_copy_index() -> crate::Result<()> {
2626 let repo_files = dir_structure ( & path) ;
2727 let copy_files = dir_structure ( output) ;
2828
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 ( ) ;
3129 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 <_>>( )
3738 ) ;
3839
3940 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) ?) ;
4742 #[ cfg( unix) ]
4843 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" ,
5247 file1. display( ) ,
5348 file2. display( ) ,
5449 ) ;
@@ -76,39 +71,28 @@ fn test_copy_index_without_symlinks() -> crate::Result<()> {
7671 let repo_files = dir_structure ( & path) ;
7772 let copy_files = dir_structure ( output) ;
7873
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 ( ) ;
8174 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 <_>>( )
8783 ) ;
8884
8985 for ( file1, file2) in repo_files. iter ( ) . zip ( copy_files. iter ( ) ) {
9086 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) ?) ;
9989 } 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) ?) ;
10791 #[ cfg( unix) ]
10892 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" ,
11296 file1. display( ) ,
11397 file2. display( ) ,
11498 ) ;
0 commit comments