summaryrefslogtreecommitdiffstats
path: root/tokio/tests/fs_file.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/tests/fs_file.rs')
-rw-r--r--tokio/tests/fs_file.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tokio/tests/fs_file.rs b/tokio/tests/fs_file.rs
index 3a56276e..8913a602 100644
--- a/tokio/tests/fs_file.rs
+++ b/tokio/tests/fs_file.rs
@@ -39,3 +39,23 @@ async fn basic_write() {
fn tempfile() -> NamedTempFile {
NamedTempFile::new().unwrap()
}
+
+#[tokio::test]
+#[cfg(unix)]
+async fn unix_fd() {
+ use std::os::unix::io::AsRawFd;
+ let tempfile = tempfile();
+
+ let file = File::create(tempfile.path()).await.unwrap();
+ assert!(file.as_raw_fd() as u64 > 0);
+}
+
+#[tokio::test]
+#[cfg(windows)]
+async fn windows_handle() {
+ use std::os::windows::io::AsRawHandle;
+ let tempfile = tempfile();
+
+ let file = File::create(tempfile.path()).await.unwrap();
+ assert!(file.as_raw_handle() as u64 > 0);
+}