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 2
2
// compile-flags: -Zmiri-disable-isolation
3
3
4
4
use std:: fs:: { File , remove_file} ;
5
- use std:: io:: { Read , Write } ;
5
+ use std:: io:: { Read , Write , ErrorKind } ;
6
6
7
7
fn main ( ) {
8
8
let path = std:: env:: temp_dir ( ) . join ( "miri_test_fs.txt" ) ;
@@ -23,8 +23,10 @@ fn main() {
23
23
assert_eq ! ( bytes, contents. as_slice( ) ) ;
24
24
// Removing file should succeed
25
25
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 a non-existing file should fail with a "not found" error.
29
+ assert_eq ! ( ErrorKind :: NotFound , File :: open( & path) . unwrap_err( ) . kind( ) ) ;
30
+ // Removing a non-existing file should fail with a "not found" error.
31
+ assert_eq ! ( ErrorKind :: NotFound , remove_file( & path) . unwrap_err( ) . kind( ) ) ;
30
32
}
You can’t perform that action at this time.
0 commit comments