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

Testing additional files in Incremental source generator snapshot tests #83

Open
tm-nti opened this issue Sep 24, 2024 · 1 comment
Open
Assignees

Comments

@tm-nti
Copy link

tm-nti commented Sep 24, 2024

I have read your awesome article on testing incremental generators:
https://andrewlock.net/creating-a-source-generator-part-2-testing-an-incremental-generator-with-snapshot-testing/

Which is great for testing compiled code, but in my use case I have some .json files I want to base the generated code on.
I am using the procedure described in the cookbook.
I managed to modify the testutil class (gist) and it seems to work

I mostly wish to know if there is a better way to do this, my modification feels dodgy and I am no expert on source generators

@sergey-shambir
Copy link

Thanks @tm-nti, I've implemented own source generator unit tests using your code example.

Result described here: https://gist.github.com/sergey-shambir/fb32a3011d8049b1b9ee76ed417ccc89

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

No branches or pull requests

3 participants