-
Notifications
You must be signed in to change notification settings - Fork 11
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
Basic verification for responses #13
Conversation
@pileghoff I can't add you as a reviewer apparently, but would you mind taking a look? (it might be that GH only allows adding maintainers which I would still be happy to add you as). |
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.
Other than two small things, it looks good 👍🏽
Also, feel free to add me as a maintainer 😀 |
a8ad05f
to
2fe4a7e
Compare
@pileghoff the generated tests are now passing, please give this another go if you don't mind. Most of the time the required fix was not serializing I will likely cut a release after this is merged. For a bit more sophisticated testing I will generate structs with random data (that's not null). I don't know if there's already some crate out there that does that but in the worst case I can write a macro for it. For testing the requests deserialization, a similar approach can be followed, but by generating JSON first and deserializing that. |
I hope to look at it over the weekend 👍🏽 I was actually about to ask about making a new release with all the new fixes. I think after this is merged is a great time. Regarding generating test data, would it be worth creating an example application that could talk to some of the most popular editors, so we could record the interaction and get some data that way? Then we could ensure that we were not only compliant with the spec, but that we also (sort of) works with those editors, in case they have some quirks or additions? |
Good idea and probably more useful than a synthetic test for the requests. They might do things slightly differently and dap-rs should work with all of them. |
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.
The tests are passing, which is the most important thing 🥇 I have a few cosmetic suggestion, but its great to see how many errors you were able to catch here, so we dont have to fix them individually as users encounters them.
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.
I think it looks good 👍🏽
This PR adds a new crate called
integration_tests
which has a build script that generates tests from all response variants. The tests have two forms:For variants that don't hold data:
For variants that hold data:
So this relies on the
Default
impl for each type. Obviously, this will mean that anyOption
s will beNone
so many fields are not actually tested. But this is a good starting point.syn
can be used to discover the struct fields and set them to generate more kinds of tests.DRAFT: currently I cannot make the tests fail by renaming a field completely so I'm doing something wrong.