File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 4
4
use std:: time:: SystemTime ;
5
5
6
6
fn main ( ) {
7
- let _now = SystemTime :: now ( ) ;
7
+ let now1 = SystemTime :: now ( ) ;
8
+
9
+ // Do some work to make time pass.
10
+ for _ in 0 ..10 { drop ( vec ! [ 42 ] ) ; }
11
+
12
+ let now2 = SystemTime :: now ( ) ;
13
+ assert ! ( now2 > now1) ;
8
14
}
Original file line number Diff line number Diff line change @@ -215,9 +215,13 @@ fn test_directory() {
215
215
// Clean up the files in the directory
216
216
remove_file ( & path_1) . unwrap ( ) ;
217
217
remove_file ( & path_2) . unwrap ( ) ;
218
+ // Now there should be nothing left in the directory.
219
+ let dir_iter = read_dir ( & dir_path) . unwrap ( ) ;
220
+ let file_names = dir_iter. map ( |e| e. unwrap ( ) . file_name ( ) ) . collect :: < Vec < _ > > ( ) ;
221
+ assert ! ( file_names. is_empty( ) ) ;
218
222
219
223
// Deleting the directory should succeed.
220
224
remove_dir ( & dir_path) . unwrap ( ) ;
221
- // Reading the metadata of a non-existent file should fail with a "not found" error.
225
+ // Reading the metadata of a non-existent directory should fail with a "not found" error.
222
226
assert_eq ! ( ErrorKind :: NotFound , check_metadata( & [ ] , & dir_path) . unwrap_err( ) . kind( ) ) ;
223
227
}
You can’t perform that action at this time.
0 commit comments