File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,18 +83,26 @@ fn test_invalid_input() {
8383 let scene = TestScenario :: new ( util_name ! ( ) ) ;
8484 let at = & scene. fixtures ;
8585
86+ #[ cfg( not( windows) ) ]
87+ let not_found_err = "failed to open 'b' for reading: No such file or directory" ;
88+ #[ cfg( windows) ]
89+ let not_found_err = "failed to open 'b' for reading: The system cannot find the file specified." ;
90+
8691 scene
8792 . ucmd ( )
8893 . arg ( "b" )
8994 . fails ( )
90- . stderr_contains ( "failed to open 'b' for reading: No such file or directory" ) ;
95+ . stderr_contains ( not_found_err ) ;
9196
9297 at. mkdir ( "a" ) ;
93- scene
94- . ucmd ( )
95- . arg ( "a" )
96- . fails ( )
97- . stderr_contains ( "a: read error: Is a directory" ) ;
98+ // On Unix, File::open succeeds on directories but read_to_end fails with EISDIR.
99+ // On Windows, File::open on a directory fails with "Access is denied".
100+ #[ cfg( not( windows) ) ]
101+ let dir_err = "a: read error: Is a directory" ;
102+ #[ cfg( windows) ]
103+ let dir_err = "failed to open 'a' for reading: Access is denied" ;
104+
105+ scene. ucmd ( ) . arg ( "a" ) . fails ( ) . stderr_contains ( dir_err) ;
98106}
99107
100108#[ test]
@@ -387,7 +395,7 @@ fn test_failed_write_is_reported() {
387395 . pipe_in ( "hello" )
388396 . set_stdout ( std:: fs:: File :: create ( "/dev/full" ) . unwrap ( ) )
389397 . fails ( )
390- . stderr_is ( "tac: failed to write to stdout: No space left on device (os error 28) \n " ) ;
398+ . stderr_is ( "tac: failed to write to stdout: No space left on device\n " ) ;
391399}
392400
393401#[ cfg( target_os = "linux" ) ]
You can’t perform that action at this time.
0 commit comments