Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ergonomics to testing with frames #64

Merged
merged 4 commits into from
Sep 8, 2017
Merged

add ergonomics to testing with frames #64

merged 4 commits into from
Sep 8, 2017

Conversation

seanmonstar
Copy link
Member

@seanmonstar seanmonstar commented Sep 7, 2017

  • Add support::frames builders, to ease creating frames to compare with or send on the mocked IO.
  • Add extension methods for futures that return a Handle, such as send_frame and recv_frame.

Ends up looking something like this:

let mock = srv.assert_client_handshake().unwrap()
    .recv_settings()
    .recv_frame(
        frames::headers(1)
            .request("GET", "https://http2.akamai.com/")
            .eos()
    )
    .send_frame(
        frames::headers(1)
            .response(200)
    )
    // send 2 data frames
    .send_frame(frames::data(1, &payload[..]))
    .send_frame(frames::data(1, &payload[..]).eos())
    // gotta end the connection
    .map(drop);

This was referenced Sep 8, 2017
@carllerche
Copy link
Collaborator

Tests look much nicer.

It's a bit late for me to digest all the type related implementation detail, but merge it if you want to. We can always iterate on master.

@seanmonstar seanmonstar merged commit b9e9fc6 into hyperium:master Sep 8, 2017
@seanmonstar seanmonstar deleted the tests-ergo-frames branch September 8, 2017 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants