1
0
Fork 0
firefox/third_party/rust/tokio/tests/fs.rs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

20 lines
491 B
Rust

#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use tokio::fs;
use tokio_test::assert_ok;
#[tokio::test]
async fn path_read_write() {
let temp = tempdir();
let dir = temp.path();
assert_ok!(fs::write(dir.join("bar"), b"bytes").await);
let out = assert_ok!(fs::read(dir.join("bar")).await);
assert_eq!(out, b"bytes");
}
fn tempdir() -> tempfile::TempDir {
tempfile::tempdir().unwrap()
}