Merge pull request #4370 from Noratrieb/fix-for-real
Make sure to sync on file-io.rs tokio test
This commit is contained in:
commit
c10a629224
1 changed files with 4 additions and 0 deletions
|
|
@ -21,6 +21,10 @@ async fn test_create_and_write() -> io::Result<()> {
|
|||
|
||||
// Write 10 bytes to the file.
|
||||
file.write_all(b"some bytes").await?;
|
||||
// For tokio's file I/O, `await` does not have its usual semantics of waiting until the
|
||||
// operation is completed, so we have to wait some more to make sure the write is completed.
|
||||
file.flush().await?;
|
||||
// Check that 10 bytes have been written.
|
||||
assert_eq!(file.metadata().await.unwrap().len(), 10);
|
||||
|
||||
remove_file(&path).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue