forked from VerifyTests/Verify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dad2a6
commit 942f581
Showing
3 changed files
with
10 additions
and
13 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
src/Verify.MSTest.SourceGenerator.Tests/GeneratorDriverResults.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
namespace VerifyMSTest.SourceGenerator.Tests; | ||
|
||
readonly record struct GeneratorDriverResults(GeneratorDriverResult FirstRun, GeneratorDriverResult CachedRun); | ||
|
||
readonly record struct GeneratorDriverResult(GeneratorDriverRunResult RunResult, GeneratorDriverTimingInfo TimingInfo); |
16 changes: 7 additions & 9 deletions
16
src/Verify.MSTest.SourceGenerator.Tests/GeneratorDriverRunResultExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
namespace VerifyMSTest.SourceGenerator.Tests; | ||
|
||
static class GeneratorDriverRunResultExtensions | ||
{ | ||
public static (string HintName, string SourceText)? SelectGeneratedSources(this GeneratorDriverRunResult gdrr) => | ||
gdrr | ||
public static (string HintName, string SourceText)? SelectGeneratedSources(this GeneratorDriverRunResult runResult) => | ||
runResult | ||
.Results | ||
.SelectMany(grr => grr.GeneratedSources) | ||
.Select(gs => (gs.HintName, gs.SourceText.ToString())) | ||
.SelectMany(_ => _.GeneratedSources) | ||
.Select(_ => (_.HintName, _.SourceText.ToString())) | ||
.SingleOrDefault(); | ||
|
||
public static Dictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> GetTrackedSteps(this GeneratorDriverRunResult runResult, IReadOnlyCollection<string> trackingNames) => | ||
runResult | ||
.Results | ||
.SelectMany(result => result.TrackedSteps) | ||
.Where(step => trackingNames.Contains(step.Key)) | ||
.ToDictionary(x => x.Key, x => x.Value); | ||
.SelectMany(_ => _.TrackedSteps) | ||
.Where(_ => trackingNames.Contains(_.Key)) | ||
.ToDictionary(_ => _.Key, _ => _.Value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters