Skip to content

Commit 329310f

Browse files
committed
Clean paths for robustness
1 parent 4a1dbc7 commit 329310f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/run-pass/fs.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ fn main() {
1919
let tmp = std::env::temp_dir();
2020
let filename = PathBuf::from("miri_test_fs.txt");
2121
let path = tmp.join(&filename);
22+
let symlink_path = tmp.join("miri_test_fs_symlink.txt");
2223
let bytes = b"Hello, World!\n";
24+
// Clean the paths for robustness.
25+
remove_file(&path).unwrap_or(());
26+
remove_file(&symlink_path).unwrap_or(());
2327

2428
// Test creating, writing and closing a file (closing is tested when `file` is dropped).
2529
let mut file = File::create(&path).unwrap();
@@ -42,8 +46,7 @@ fn main() {
4246
std::env::set_current_dir(&tmp).unwrap();
4347
test_metadata(bytes, &filename).unwrap();
4448

45-
// Creating a symbolic link should succeed
46-
let symlink_path = tmp.join("miri_test_fs_symlink.txt");
49+
// Creating a symbolic link should succeed.
4750
std::os::unix::fs::symlink(&path, &symlink_path).unwrap();
4851
// Test that the symbolic link has the same contents as the file.
4952
let mut symlink_file = File::open(&symlink_path).unwrap();

0 commit comments

Comments
 (0)