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 tests for generated code #1038

Closed
GuillaumeGomez opened this issue May 14, 2024 · 2 comments · Fixed by #1040
Closed

Add tests for generated code #1038

GuillaumeGomez opened this issue May 14, 2024 · 2 comments · Fixed by #1040

Comments

@GuillaumeGomez
Copy link
Collaborator

In #1037, I tried to add tests for generated content but it was quite ugly so I finally didn't put it into the PR until I find a better implementation.

I still think that we should have AST tests, in particular to ensure that code generation improvements don't have "hidden" regressions and that changes don't go unnoticed.

@Kijewski
Copy link
Collaborator

I guess we could do something like syn::parse(generated_code) == syn::parse("expected::code()"). syn's PartialEq ignores spans, so I think this should work.

@GuillaumeGomez
Copy link
Collaborator Author

🤯

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 a pull request may close this issue.

2 participants