Skip to content

Commit fefa8e5

Browse files
committed
expand clock and fs tests a bit
1 parent c72af45 commit fefa8e5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/run-pass/clock.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
use std::time::SystemTime;
55

66
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);
814
}

tests/run-pass/fs.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,13 @@ fn test_directory() {
215215
// Clean up the files in the directory
216216
remove_file(&path_1).unwrap();
217217
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());
218222

219223
// Deleting the directory should succeed.
220224
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.
222226
assert_eq!(ErrorKind::NotFound, check_metadata(&[], &dir_path).unwrap_err().kind());
223227
}

0 commit comments

Comments
 (0)