summaryrefslogtreecommitdiffstats
path: root/vendor/tokio/tests/fs_remove_file.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/tokio/tests/fs_remove_file.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tokio/tests/fs_remove_file.rs')
-rw-r--r--vendor/tokio/tests/fs_remove_file.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/tokio/tests/fs_remove_file.rs b/vendor/tokio/tests/fs_remove_file.rs
new file mode 100644
index 000000000..14fd680da
--- /dev/null
+++ b/vendor/tokio/tests/fs_remove_file.rs
@@ -0,0 +1,24 @@
+#![warn(rust_2018_idioms)]
+#![cfg(all(feature = "full", not(tokio_wasi)))] // WASI does not support all fs operations
+
+use tempfile::tempdir;
+use tokio::fs;
+
+#[tokio::test]
+async fn remove_file() {
+ let temp_dir = tempdir().unwrap();
+
+ let file_path = temp_dir.path().join("a.txt");
+
+ fs::write(&file_path, b"Hello File!").await.unwrap();
+
+ assert!(fs::try_exists(&file_path).await.unwrap());
+
+ fs::remove_file(&file_path).await.unwrap();
+
+ // should no longer exist
+ match fs::try_exists(file_path).await {
+ Ok(exists) => assert!(!exists),
+ Err(_) => println!("ignored try_exists error after remove_file"),
+ };
+}