File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11// ignore-windows: File handling is not implemented yet
22// compile-flags: -Zmiri-disable-isolation
33
4- use std:: fs:: { File , remove_file} ;
4+ use std:: fs:: { File , remove_file, metadata } ;
55use std:: io:: { Read , Write , ErrorKind } ;
66
77fn main ( ) {
@@ -21,7 +21,15 @@ fn main() {
2121 // Reading until EOF should get the whole text.
2222 file. read_to_end ( & mut contents) . unwrap ( ) ;
2323 assert_eq ! ( bytes, contents. as_slice( ) ) ;
24- // Removing file should succeed
24+
25+ // Test that the file metadata is correct.
26+ let metadata = metadata ( & path) . unwrap ( ) ;
27+ // `path` should point to a file.
28+ assert ! ( metadata. is_file( ) ) ;
29+ // The size of the file must be equal to the number of written bytes.
30+ assert_eq ! ( bytes. len( ) as u64 , metadata. len( ) ) ;
31+
32+ // Removing file should succeed.
2533 remove_file ( & path) . unwrap ( ) ;
2634
2735 // The two following tests also check that the `__errno_location()` shim is working properly.
You can’t perform that action at this time.
0 commit comments