File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 22// compile-flags: -Zmiri-disable-isolation
33
44use std:: fs:: { File , remove_file} ;
5- use std:: io:: { Read , Write } ;
5+ use std:: io:: { Read , Write , ErrorKind } ;
66
77fn main ( ) {
88 let path = std:: env:: temp_dir ( ) . join ( "miri_test_fs.txt" ) ;
@@ -23,8 +23,10 @@ fn main() {
2323 assert_eq ! ( bytes, contents. as_slice( ) ) ;
2424 // Removing file should succeed
2525 remove_file ( & path) . unwrap ( ) ;
26- // Opening non-existing file should fail
27- assert ! ( File :: open( & path) . is_err( ) ) ;
28- // Removing non-existing file should fail
29- assert ! ( remove_file( & path) . is_err( ) ) ;
26+
27+ // The two following tests also check that the `__errno_location()` shim is working properly.
28+ // Opening non-existing file should fail with a not found error
29+ assert_eq ! ( ErrorKind :: NotFound , File :: open( & path) . unwrap_err( ) . kind( ) ) ;
30+ // Removing non-existing file should fail with a not found error
31+ assert_eq ! ( ErrorKind :: NotFound , remove_file( & path) . unwrap_err( ) . kind( ) ) ;
3032}
You can’t perform that action at this time.
0 commit comments