fs: flush on shutdown (#3009)

Fixes: #2950
This commit is contained in:
Zahari Dichev
2020-10-20 17:42:32 +02:00
committed by GitHub
parent 6d99e1c7de
commit 16e272ea4b
2 changed files with 15 additions and 3 deletions
+13
View File
@@ -37,6 +37,19 @@ async fn basic_write() {
assert_eq!(file, HELLO);
}
#[tokio::test]
async fn basic_write_and_shutdown() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[tokio::test]
async fn coop() {
let mut tempfile = tempfile();