mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
parent
6d99e1c7de
commit
16e272ea4b
@ -682,9 +682,8 @@ impl AsyncWrite for File {
|
|||||||
inner.poll_flush(cx)
|
inner.poll_flush(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
|
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
|
||||||
// Flush is a noop for files so it's fine not to call it.
|
self.poll_flush(cx)
|
||||||
Poll::Ready(Ok(()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,19 @@ async fn basic_write() {
|
|||||||
assert_eq!(file, HELLO);
|
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]
|
#[tokio::test]
|
||||||
async fn coop() {
|
async fn coop() {
|
||||||
let mut tempfile = tempfile();
|
let mut tempfile = tempfile();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user