mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
tests: complete TODOs in uds_stream (#4587)
This commit is contained in:
@@ -25,13 +25,13 @@ async fn accept_read_write() -> std::io::Result<()> {
|
|||||||
let connect = UnixStream::connect(&sock_path);
|
let connect = UnixStream::connect(&sock_path);
|
||||||
let ((mut server, _), mut client) = try_join(accept, connect).await?;
|
let ((mut server, _), mut client) = try_join(accept, connect).await?;
|
||||||
|
|
||||||
// Write to the client. TODO: Switch to write_all.
|
// Write to the client.
|
||||||
let write_len = client.write(b"hello").await?;
|
client.write_all(b"hello").await?;
|
||||||
assert_eq!(write_len, 5);
|
|
||||||
drop(client);
|
drop(client);
|
||||||
// Read from the server. TODO: Switch to read_to_end.
|
|
||||||
let mut buf = [0u8; 5];
|
// Read from the server.
|
||||||
server.read_exact(&mut buf).await?;
|
let mut buf = vec![];
|
||||||
|
server.read_to_end(&mut buf).await?;
|
||||||
assert_eq!(&buf, b"hello");
|
assert_eq!(&buf, b"hello");
|
||||||
let len = server.read(&mut buf).await?;
|
let len = server.read(&mut buf).await?;
|
||||||
assert_eq!(len, 0);
|
assert_eq!(len, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user