Files
h2/tests/ping_pong.rs
Oliver Gould 897bf84163 Use rustfmt to enforce consistent formatting
This change adds a .rustfmt.toml that includes ALL supported settings,
12 of which we have overridden to attempt to cater to our own
proclivities.

rustfmt is checked in the rust-nightly CI job.
2017-09-12 22:29:35 +00:00

35 lines
844 B
Rust

#[macro_use]
extern crate h2_test_support;
use h2_test_support::prelude::*;
#[test]
fn recv_single_ping() {
let _ = ::env_logger::init();
let (m, mock) = mock::new();
// Create the handshake
let h2 = Client::handshake(m).unwrap().and_then(|conn| conn.unwrap());
let mock = mock.assert_client_handshake()
.unwrap()
.and_then(|(_, mut mock)| {
let frame = frame::Ping::new();
mock.send(frame.into()).unwrap();
mock.into_future().unwrap()
})
.and_then(|(frame, _)| {
let pong = assert_ping!(frame.unwrap());
// Payload is correct
assert_eq!(*pong.payload(), <[u8; 8]>::default());
// Is ACK
assert!(pong.is_ack());
Ok(())
});
let _ = h2.join(mock).wait().unwrap();
}