blog-examples
blog-examples copied to clipboard
Testing additional files in Incremental source generator snapshot tests
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
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