-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
experience-hardThis issue is hard, and requires a lot of experienceThis issue is hard, and requires a lot of experiencehelp wantedExtra attention is neededExtra attention is needed
Description
As zerocopy-derive gets more powerful, it becomes harder to test every edge case just through compile-success and compile-fail tests. One way we could test at a higher fidelity would be to assert the exact token stream output as a result of deriving traits on various types. This would be in some ways easier to verify for a human reviewer, and would be more stable than compiler error messages (a problem that plagues our existing trybuild tests, and requires us to keep three separate copies of the .stderr files - one for each toolchain we use in CI).
A few ways we could do this:
- Use
cargo expand
- Use synstructure's test_derive! macro
I'm currently leaning towards test_derive!
, as it seems to do exactly what we want.
Mentoring
Steps:
- Add
synstructure
dev-dependency to zerocopy-derive - Add a basic test and confirm that it works (this and the previous step could be their own PR)
- Come up with as many test cases as you can think of! Consider using our existing tests (
zerocopy-derive/tests/*.rs
) and trybuild tests (zerocopy-derive/tests/ui-*.rs
) to help give you ideas.
Metadata
Metadata
Assignees
Labels
experience-hardThis issue is hard, and requires a lot of experienceThis issue is hard, and requires a lot of experiencehelp wantedExtra attention is neededExtra attention is needed