From 702d6dccc948b6a460caa52da4e4c03b252c5c3b Mon Sep 17 00:00:00 2001 From: Arash Sal Moslehian <57039957+arashsm79@users.noreply.github.com> Date: Mon, 28 Mar 2022 12:58:06 -0700 Subject: [PATCH] tests: complete TODOs in `uds_stream` (#4587) --- tokio/tests/uds_stream.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tokio/tests/uds_stream.rs b/tokio/tests/uds_stream.rs index 5f1b4cffbcc..b8c4e6a8eed 100644 --- a/tokio/tests/uds_stream.rs +++ b/tokio/tests/uds_stream.rs @@ -25,13 +25,13 @@ async fn accept_read_write() -> std::io::Result<()> { let connect = UnixStream::connect(&sock_path); let ((mut server, _), mut client) = try_join(accept, connect).await?; - // Write to the client. TODO: Switch to write_all. - let write_len = client.write(b"hello").await?; - assert_eq!(write_len, 5); + // Write to the client. + client.write_all(b"hello").await?; drop(client); - // Read from the server. TODO: Switch to read_to_end. - let mut buf = [0u8; 5]; - server.read_exact(&mut buf).await?; + + // Read from the server. + let mut buf = vec![]; + server.read_to_end(&mut buf).await?; assert_eq!(&buf, b"hello"); let len = server.read(&mut buf).await?; assert_eq!(len, 0);