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

View File

@@ -14,7 +14,6 @@ addons:
rust:
- nightly
- beta
- stable
install:
@@ -24,15 +23,21 @@ before_script:
- cargo clean
script:
# Test examples in README.
- cargo build --tests && rustdoc --test README.md -L target/debug/deps
# Build without unstable flag
- cargo build
# Test examples in README.
- rustdoc --test README.md -L target/debug -L target/debug/deps
# Check with unstable flag
- cargo check --features unstable
# Run tests, uploading results to codecov..
# hpack tests are _super_ slow in coverage, so skip them here.
- cargo tarpaulin --out Xml -- --skip hpack
- cargo tarpaulin --features unstable --out Xml -- --skip hpack
# Test _only_ hpack.
- cargo test -- hpack
- cargo test --lib -- hpack
after_success:
- bash <(curl -Ls https://codecov.io/bash)

View File

@@ -36,14 +36,7 @@ string = { git = "https://github.com/carllerche/string" }
ordermap = "0.2"
[dev-dependencies]
# Support code for tests. Ideally this wouldn't be released to crates.io, but
# until rust-lang/cargo#4466 is resolved, we just have to publish this junk crate.
#
# The dependency is set on a fixed version as the `h2-test-support` offers no
# guarantees of backwards compatibility across minor versions. The version of
# `h2-test-support` should always match the current version of `h2`.
h2-test-support = { version = "= 0.1.0", path = "tests/support" }
mock-io = { git = "https://github.com/carllerche/mock-io", branch = "experiments" }
# Fuzzing
quickcheck = "0.4.1"

View File

@@ -1,8 +1,8 @@
#[macro_use]
extern crate log;
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
#[test]
fn handshake() {

View File

@@ -1,6 +1,6 @@
#[macro_use]
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
use std::error::Error;

View File

@@ -1,6 +1,6 @@
#[macro_use]
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
// In this case, the stream & connection both have capacity, but capacity is not
// explicitly requested.

View File

@@ -1,6 +1,6 @@
#[macro_use]
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
#[test]
fn recv_single_ping() {

View File

@@ -1,6 +1,6 @@
#[macro_use]
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
#[test]
fn single_stream_send_large_body() {

View File

@@ -1,5 +1,5 @@
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
#[test]
fn recv_push_works() {

View File

@@ -1,5 +1,5 @@
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
const SETTINGS: &'static [u8] = &[0, 0, 0, 4, 0, 0, 0, 0, 0];
const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];

View File

@@ -1,8 +1,8 @@
#[macro_use]
extern crate log;
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
#[test]
fn send_recv_headers_only() {

View File

@@ -1,17 +0,0 @@
[package]
name = "h2-test-support"
version = "0.1.0"
authors = ["Carl Lerche <me@carllerche.com>"]
[dependencies]
futures = "0.1"
tokio-io = "0.1"
bytes = "0.4"
http = { git = "https://github.com/carllerche/http" }
env_logger = "0.4"
mock-io = { git = "https://github.com/carllerche/mock-io", branch = "experiments" }
[dependencies.h2]
path = "../.."
features = ["unstable"]

View File

@@ -1,3 +0,0 @@
**This is not a real crate**
You should not use this crate, it only exists to work around cargo limitations.

58
tests/support/mod.rs Normal file
View File

@@ -0,0 +1,58 @@
//! Utilities to support tests.
pub extern crate bytes;
pub extern crate env_logger;
pub extern crate futures;
pub extern crate h2;
pub extern crate http;
pub extern crate mock_io;
pub extern crate tokio_io;
// Kind of annoying, but we can't use macros from crates that aren't specified
// at the root.
macro_rules! try_ready {
($e:expr) => ({
use $crate::support::futures::Async;
match $e {
Ok(Async::Ready(t)) => t,
Ok(Async::NotReady) => return Ok(Async::NotReady),
Err(e) => return Err(From::from(e)),
}
})
}
macro_rules! try_nb {
($e:expr) => ({
use $crate::support::futures::Async;
use ::std::io::ErrorKind::WouldBlock;
match $e {
Ok(t) => t,
Err(ref e) if e.kind() == WouldBlock => {
return Ok(Async::NotReady)
}
Err(e) => return Err(e.into()),
}
})
}
#[macro_use]
mod assert;
#[macro_use]
pub mod raw;
pub mod frames;
pub mod prelude;
pub mod mock;
pub mod util;
mod future_ext;
pub use self::future_ext::{FutureExt, Unwrap};
// This is our test Codec type
pub type Codec<T> = h2::Codec<T, ::std::io::Cursor<::bytes::Bytes>>;
// This is the frame type that is sent
pub type SendFrame = h2::frame::Frame<::std::io::Cursor<::bytes::Bytes>>;

View File

@@ -26,7 +26,7 @@ pub use super::{bytes, env_logger, futures, http, mock_io, tokio_io};
pub use self::futures::{Future, Sink, Stream};
// And our Future extensions
pub use future_ext::{FutureExt, Unwrap};
pub use super::future_ext::{FutureExt, Unwrap};
// Re-export HTTP types
pub use self::http::{HeaderMap, Method, Request, Response, StatusCode};

View File

@@ -7,19 +7,19 @@ macro_rules! raw_codec {
$fn:ident => [$($chunk:expr,)+];
)*
) => {{
let mut b = $crate::mock_io::Builder::new();
let mut b = $crate::support::mock_io::Builder::new();
$({
let mut chunk = vec![];
$(
$crate::raw::Chunk::push(&$chunk, &mut chunk);
$crate::support::raw::Chunk::push(&$chunk, &mut chunk);
)+
b.$fn(&chunk[..]);
})*
$crate::Codec::new(b.build())
$crate::support::Codec::new(b.build())
}}
}

View File

@@ -1,34 +0,0 @@
//! Utilities to support tests.
pub extern crate bytes;
pub extern crate h2;
pub extern crate http;
#[macro_use]
pub extern crate tokio_io;
pub extern crate env_logger;
#[macro_use]
pub extern crate futures;
pub extern crate mock_io;
#[macro_use]
mod assert;
#[macro_use]
pub mod raw;
pub mod frames;
pub mod prelude;
pub mod mock;
pub mod util;
mod future_ext;
pub use future_ext::{FutureExt, Unwrap};
// This is our test Codec type
pub type Codec<T> = h2::Codec<T, ::std::io::Cursor<::bytes::Bytes>>;
// This is the frame type that is sent
pub type SendFrame = h2::frame::Frame<::std::io::Cursor<::bytes::Bytes>>;

View File

@@ -1,8 +1,8 @@
#[macro_use]
extern crate log;
extern crate h2_test_support;
use h2_test_support::prelude::*;
pub mod support;
use support::prelude::*;
#[test]
fn recv_trailers_only() {