source_gen_test icon indicating copy to clipboard operation
source_gen_test copied to clipboard

Test if the generated code matches a file

Open alexeyinkin opened this issue 2 years ago • 0 comments

I have large pieces of code generated. Testing for them using ShouldGenerate with the inline content makes it hard to read and update. Also I would like to write separate tests for the generated code. For these reasons I want to store the expected code in separate files.

This could be made with a new annotation like

@ShouldGenerateGolden('file.dart')
...

Or is there already an option to do something similar?

alexeyinkin avatar Sep 17 '22 06:09 alexeyinkin