Sometimes generators generate plenty of files
and in tests many ppl doesn't care about full output, but for 1 specified file.
We could verify using just Verify but the problem is that output would be txt so no syntax coloring
Solution
Add VerifierSettings.RegisterFileConverter<GeneratedSourceResult>(Convert); into VerifySourceGenerators.Initialize method.
The Convert method could be like:
Issue
Sometimes generators generate plenty of files and in tests many ppl doesn't care about full output, but for 1 specified file.
We could verify using just
Verify
but the problem is that output would betxt
so no syntax coloringSolution
Add
VerifierSettings.RegisterFileConverter<GeneratedSourceResult>(Convert);
intoVerifySourceGenerators.Initialize
method. TheConvert
method could be like:everything else already exists
so final code in test liblary would be:
It looks like it would match to the logic from readme file
P.S. I don't need it, I'm able to add it by my own but I think that could be helpful for other ppl who use source generators and Verify