Remove h2-test-support crate (#119)

The h2-test-support caused the unstable flag to always be enabled.
This commit is contained in:
Carl Lerche
2017-09-25 22:28:39 -07:00
committed by GitHub
parent 549d96a36b
commit 8911ee2a4b
22 changed files with 91 additions and 89 deletions

52
tests/support/raw.rs Normal file
View File

@@ -0,0 +1,52 @@
// ===== Build a codec from raw bytes =====
#[macro_export]
macro_rules! raw_codec {
(
$(
$fn:ident => [$($chunk:expr,)+];
)*
) => {{
let mut b = $crate::support::mock_io::Builder::new();
$({
let mut chunk = vec![];
$(
$crate::support::raw::Chunk::push(&$chunk, &mut chunk);
)+
b.$fn(&chunk[..]);
})*
$crate::support::Codec::new(b.build())
}}
}
pub trait Chunk {
fn push(&self, dst: &mut Vec<u8>);
}
impl Chunk for u8 {
fn push(&self, dst: &mut Vec<u8>) {
dst.push(*self);
}
}
impl<'a> Chunk for &'a [u8] {
fn push(&self, dst: &mut Vec<u8>) {
dst.extend(*self)
}
}
impl<'a> Chunk for &'a str {
fn push(&self, dst: &mut Vec<u8>) {
dst.extend(self.as_bytes())
}
}
impl Chunk for Vec<u8> {
fn push(&self, dst: &mut Vec<u8>) {
dst.extend(self.iter())
}
}