1#![warn(rust_2018_idioms)]
2#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
3
4use tokio::fs;
5use tokio_test::assert_ok;
6
7#[tokio::test]
8async fn path_read_write() {
9 let temp = tempdir();
10 let dir = temp.path();
11
12 assert_ok!(fs::write(dir.join("bar"), b"bytes").await);
13 let out = assert_ok!(fs::read(dir.join("bar")).await);
14
15 assert_eq!(out, b"bytes");
16}
17
18fn tempdir() -> tempfile::TempDir {
19 tempfile::tempdir().unwrap()
20}
21