Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various test clean ups #1145

Merged
merged 9 commits into from
Nov 23, 2019
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ lazy_static = "1.4.0"
# for testing we'll use the git version.
bytes = { version = "0.5.0", git = "https://github.com/tokio-rs/bytes", rev = "79e4b2847f27137faaf149d116a352cbeae47fd1" }
env_logger = { version = "0.6.2", default-features = false }
slab = "0.4.2"
tempdir = "0.3.7"
net2 = "0.2.33"

Expand Down
13 changes: 7 additions & 6 deletions tests/close_on_drop.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use bytes::BytesMut;
use std::io::Read;

use log::debug;

use mio::net::{TcpListener, TcpStream};
use mio::{Events, Interests, Poll, Token};

mod util;

use util::{any_local_address, init, TryRead};
use util::{any_local_address, init};

use self::TestState::{AfterRead, Initial};

Expand Down Expand Up @@ -50,16 +51,16 @@ impl TestHandler {
match self.state {
Initial => {
let mut buf = [0; 4096];
debug!("GOT={:?}", self.cli.try_read(&mut buf[..]));
debug!("GOT={:?}", self.cli.read(&mut buf[..]));
self.state = AfterRead;
}
AfterRead => {}
}

let mut buf = BytesMut::with_capacity(1024);
let mut buf = Vec::with_capacity(1024);

match self.cli.try_read_buf(&mut buf) {
Ok(Some(0)) => self.shutdown = true,
match self.cli.read(&mut buf) {
Ok(0) => self.shutdown = true,
Ok(_) => panic!("the client socket should not be readable"),
Err(e) => panic!("Unexpected error {:?}", e),
}
Expand Down
Loading