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

Improvements related to databake::test_bake!() #4182

Merged
merged 9 commits into from
Oct 20, 2023

Conversation

alvra
Copy link
Contributor

@alvra alvra commented Oct 19, 2023

This PR improves the usefulness of the test_bake! macro by making sure the baked tokenstream matches the literal constructor.

  • update the implementations for slices and tuples
  • convert corresponding tests to use test_bake!
  • enable some tests that now pass
  • more test coverage for slices and Cow

I've also tried to modify the output of the Bake derive macro so test_bake! works everywhere but I couldn't figure out the logic for when commas are omitted or not so that's not part of this PR. Unfortunately this means that derived implementations still cannot always be tested using test_bake!. But with this PR, at least primitives, manual implementations, and combinations thereof will now work.

@CLAassistant
Copy link

CLAassistant commented Oct 19, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great! Did you check whether any other mentions of https://github.com/rust-lang/rust/issues/98906 in the repo can be reenabled now?

utils/databake/src/alloc.rs Outdated Show resolved Hide resolved
sffc
sffc previously approved these changes Oct 19, 2023
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also fix the other instances of rust-lang/rust#98906 scattered through the codebase?

@alvra alvra requested a review from a team as a code owner October 20, 2023 07:43
@alvra
Copy link
Contributor Author

alvra commented Oct 20, 2023

I've enables 2 tests outside of databake that now pass.

  • For one of these I had to update the test itself too, could you verify this is correct?
  • There's another test ignored because of rust#98906 that fails for a different reason and could probably be enabled: components/list/src/provider/serde_dfa.rs:L231

The other 3 tests ignored use derived Bake impls so they still fail over commas unfortunately.

@Manishearth
Copy link
Member

This is great, thanks!

@robertbastian robertbastian merged commit 463a9e8 into unicode-org:main Oct 20, 2023
28 checks passed
@alvra alvra deleted the feature/improve-test-bake branch October 20, 2023 16:17
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.

5 participants