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 ProjectState.GeneratedSources API #759

Merged
merged 5 commits into from
Mar 11, 2021

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Mar 11, 2021

  • Add ProjectState.GeneratedSources. This is the primary property that will eventually allow any test (analyzer, code fix, refactoring, or source generator) to include generated sources.
  • Add TestBehaviors.SkipGeneratedSourcesCheck, which allows tests to implicitly include source generator outputs (as opposed to verifying that they match the contents of GeneratedSources).
  • Rewrite source generator testing to no longer verify diagnostics for the intermediate state prior to running source generators.

Closes #754

@sharwell sharwell marked this pull request as ready for review March 11, 2021 16:56
@sharwell sharwell requested a review from a team as a code owner March 11, 2021 16:56
@sharwell sharwell force-pushed the generated-sources branch from da7fc07 to e0c5578 Compare March 11, 2021 17:32
@sharwell sharwell merged commit ea51db4 into dotnet:main Mar 11, 2021
@sharwell sharwell deleted the generated-sources branch March 11, 2021 18:17
@sharwell
Copy link
Member Author

@KathleenDollard @clairernovotny this is a big change to the source generator testing API which makes testing much simpler. It should be in signed builds within the hour. You can see examples of the change impact in SourceGeneratorValidationTests.cs; let me know if you have any questions about updating.

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 this pull request may close these issues.

It is hard to use test framework for source generators
2 participants