More test cleanup
This commit is contained in:
@@ -16,6 +16,7 @@ pub use self::futures::{
|
||||
pub use self::http::{
|
||||
request,
|
||||
response,
|
||||
method,
|
||||
status,
|
||||
};
|
||||
|
||||
@@ -24,6 +25,13 @@ pub use self::h2::{
|
||||
server,
|
||||
};
|
||||
|
||||
pub use self::bytes::{
|
||||
Buf,
|
||||
BufMut,
|
||||
Bytes,
|
||||
BytesMut,
|
||||
};
|
||||
|
||||
pub trait MockH2 {
|
||||
fn handshake(&mut self) -> &mut Self;
|
||||
}
|
||||
@@ -44,3 +52,27 @@ pub mod frames {
|
||||
pub const SETTINGS: &'static [u8] = &[0, 0, 0, 4, 0, 0, 0, 0, 0];
|
||||
pub const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_user_err {
|
||||
($actual:expr, $err:ident) => {{
|
||||
use h2::error::{ConnectionError, User};
|
||||
|
||||
match $actual {
|
||||
ConnectionError::User(e) => assert_eq!(e, User::$err),
|
||||
_ => panic!("unexpected connection error type"),
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_proto_err {
|
||||
($actual:expr, $err:ident) => {{
|
||||
use h2::error::{ConnectionError, Reason};
|
||||
|
||||
match $actual {
|
||||
ConnectionError::Proto(e) => assert_eq!(e, Reason::$err),
|
||||
_ => panic!("unexpected connection error type"),
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user