-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 support for expected objects to roundtrip test #69
Add support for expected objects to roundtrip test #69
Conversation
93e86cc
to
4494e5a
Compare
Something weird here. I've run |
You need a nightly formatter: |
🙃 I have been running In this case, I had multiple trailing blank lines in a doc comment, and it was only stripping them off one line at a time. The next force-push I make should pass |
4494e5a
to
47f40e3
Compare
Turned out to be true and submitted a fix: rust-lang/rustfmt#6163 |
Wow, crazy! I didn't have time to look deeper in the code but it's cool that you've found a bug and submitted a fix PR 👏 |
These look great! Once this is merged I'm happy to go back and implement the same for the OpenSSH extensions we have built in, as they also implement their own roundtrip test logic; much nicer to make it more unified! |
47f40e3
to
3200b8d
Compare
Just broke this PR up into two separate commits to, hopefully, make it easier to review:
|
Okay, I've read it. I didn't expect it but it's an clever solution and the line-count is good so let's go ahead and merge it 🎉 Could you rebase on top of |
Add optional support to test the deserialized bytes against an expected static object. Uses a macro to concisely list modules that contain an `expected()` function that returns the expected `Request` or `Response` object. Existing tests could have expected objects added to improve the error reporting in case of test failure. Signed-off-by: Ross Williams <[email protected]>
Move tests from the `proto::message` module to `tests/roundtrip` because they were simply round-trip tests with an additional check against an expected object. Use new "expected object" support to test the deserialization against a statically-initialized object, just as the unit tests did. Signed-off-by: Ross Williams <[email protected]>
Usage examples had wrong syntax Signed-off-by: Ross Williams <[email protected]>
3200b8d
to
65f8481
Compare
Rebased onto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thank you! 🙇♂️
Add optional support to test the deserialized bytes against an expected static object. Uses a macro to concisely list modules that contain an
expected()
function that returns the expectedRequest
orResponse
object.Existing tests could have expected objects added to improve the error reporting in case of test failure. Tests from the
proto::message
module have been moved totests/roundtrip
because they were simply round-trip tests with an additional check against an expected object.