Remove h2-test-support crate (#119)
The h2-test-support caused the unstable flag to always be enabled.
This commit is contained in:
15
.travis.yml
15
.travis.yml
@@ -14,7 +14,6 @@ addons:
|
|||||||
|
|
||||||
rust:
|
rust:
|
||||||
- nightly
|
- nightly
|
||||||
- beta
|
|
||||||
- stable
|
- stable
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@@ -24,15 +23,21 @@ before_script:
|
|||||||
- cargo clean
|
- cargo clean
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Test examples in README.
|
# Build without unstable flag
|
||||||
- cargo build --tests && rustdoc --test README.md -L target/debug/deps
|
- 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..
|
# Run tests, uploading results to codecov..
|
||||||
# hpack tests are _super_ slow in coverage, so skip them here.
|
# 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.
|
# Test _only_ hpack.
|
||||||
- cargo test -- hpack
|
- cargo test --lib -- hpack
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -Ls https://codecov.io/bash)
|
- bash <(curl -Ls https://codecov.io/bash)
|
||||||
|
|||||||
@@ -36,14 +36,7 @@ string = { git = "https://github.com/carllerche/string" }
|
|||||||
ordermap = "0.2"
|
ordermap = "0.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
mock-io = { git = "https://github.com/carllerche/mock-io", branch = "experiments" }
|
||||||
# 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" }
|
|
||||||
|
|
||||||
# Fuzzing
|
# Fuzzing
|
||||||
quickcheck = "0.4.1"
|
quickcheck = "0.4.1"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn handshake() {
|
fn handshake() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
// In this case, the stream & connection both have capacity, but capacity is not
|
// In this case, the stream & connection both have capacity, but capacity is not
|
||||||
// explicitly requested.
|
// explicitly requested.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recv_single_ping() {
|
fn recv_single_ping() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn single_stream_send_large_body() {
|
fn single_stream_send_large_body() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recv_push_works() {
|
fn recv_push_works() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
const SETTINGS: &'static [u8] = &[0, 0, 0, 4, 0, 0, 0, 0, 0];
|
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];
|
const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn send_recv_headers_only() {
|
fn send_recv_headers_only() {
|
||||||
|
|||||||
@@ -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"]
|
|
||||||
@@ -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
58
tests/support/mod.rs
Normal 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>>;
|
||||||
@@ -26,7 +26,7 @@ pub use super::{bytes, env_logger, futures, http, mock_io, tokio_io};
|
|||||||
pub use self::futures::{Future, Sink, Stream};
|
pub use self::futures::{Future, Sink, Stream};
|
||||||
|
|
||||||
// And our Future extensions
|
// And our Future extensions
|
||||||
pub use future_ext::{FutureExt, Unwrap};
|
pub use super::future_ext::{FutureExt, Unwrap};
|
||||||
|
|
||||||
// Re-export HTTP types
|
// Re-export HTTP types
|
||||||
pub use self::http::{HeaderMap, Method, Request, Response, StatusCode};
|
pub use self::http::{HeaderMap, Method, Request, Response, StatusCode};
|
||||||
@@ -7,19 +7,19 @@ macro_rules! raw_codec {
|
|||||||
$fn:ident => [$($chunk:expr,)+];
|
$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![];
|
let mut chunk = vec![];
|
||||||
|
|
||||||
$(
|
$(
|
||||||
$crate::raw::Chunk::push(&$chunk, &mut chunk);
|
$crate::support::raw::Chunk::push(&$chunk, &mut chunk);
|
||||||
)+
|
)+
|
||||||
|
|
||||||
b.$fn(&chunk[..]);
|
b.$fn(&chunk[..]);
|
||||||
})*
|
})*
|
||||||
|
|
||||||
$crate::Codec::new(b.build())
|
$crate::support::Codec::new(b.build())
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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>>;
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate h2_test_support;
|
pub mod support;
|
||||||
use h2_test_support::prelude::*;
|
use support::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recv_trailers_only() {
|
fn recv_trailers_only() {
|
||||||
|
|||||||
Reference in New Issue
Block a user