@@ -31,13 +31,18 @@ fn cannot_read_files() -> Result<(), Box<dyn std::error::Error>> {
3131 let nopath = nofile. into_temp_path ( ) ;
3232 std:: fs:: remove_file ( & nopath) ?;
3333
34+ #[ cfg( not( windows) ) ]
35+ let error_message = "No such file or directory" ;
36+ #[ cfg( windows) ]
37+ let error_message = "The system cannot find the file specified." ;
38+
3439 let mut cmd = Command :: cargo_bin ( "diffutils" ) ?;
3540 cmd. arg ( & nopath) . arg ( file. path ( ) ) ;
3641 cmd. assert ( )
3742 . code ( predicate:: eq ( 2 ) )
3843 . failure ( )
3944 . stderr ( predicate:: str:: ends_with ( format ! (
40- ": {}: No such file or directory \n " ,
45+ ": {}: {error_message} \n " ,
4146 & nopath. as_os_str( ) . to_string_lossy( )
4247 ) ) ) ;
4348
@@ -47,15 +52,15 @@ fn cannot_read_files() -> Result<(), Box<dyn std::error::Error>> {
4752 . code ( predicate:: eq ( 2 ) )
4853 . failure ( )
4954 . stderr ( predicate:: str:: ends_with ( format ! (
50- ": {}: No such file or directory \n " ,
55+ ": {}: {error_message} \n " ,
5156 & nopath. as_os_str( ) . to_string_lossy( )
5257 ) ) ) ;
5358
5459 let mut cmd = Command :: cargo_bin ( "diffutils" ) ?;
5560 cmd. arg ( & nopath) . arg ( & nopath) ;
5661 cmd. assert ( ) . code ( predicate:: eq ( 2 ) ) . failure ( ) . stderr (
5762 predicate:: str:: contains ( format ! (
58- ": {}: No such file or directory \n " ,
63+ ": {}: {error_message} \n " ,
5964 & nopath. as_os_str( ) . to_string_lossy( )
6065 ) )
6166 . count ( 2 ) ,
0 commit comments