-
Notifications
You must be signed in to change notification settings - Fork 508
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
Added support for multiple analyzers to the test verifiers #802
Added support for multiple analyzers to the test verifiers #802
Conversation
Updated to work with #841 |
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param> | ||
/// <returns>A collection of <see cref="Diagnostic"/>s that surfaced in the source code, sorted by | ||
/// <see cref="Diagnostic.Location"/>.</returns> | ||
private static Task<ImmutableArray<Diagnostic>> GetSortedDiagnosticsAsync(string[] sources, string language, DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) | ||
private static Task<ImmutableArray<Diagnostic>> GetSortedDiagnosticsAsync(string[] sources, string language, DiagnosticAnalyzer[] analyzers, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❗ Lets use ImmutableArray<DiagnosticAnalyzer> analyzers
instead of DiagnosticAnalyzer[]
.
Updated with CR comments |
{ | ||
var diagnostics = await GetSortedDiagnosticsAsync(sources, language, analyzer, cancellationToken).ConfigureAwait(false); | ||
VerifyDiagnosticResults(diagnostics, analyzer, expected); | ||
var diagnostics = await GetSortedDiagnosticsAsync(sources, language, analyzers.ToImmutableArray(), cancellationToken).ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 The call to ToImmutableArray()
is unnecessary here (I removed it when I merged this pull request).
Added support to the test verifiers to run multiple analyzers in a single test case. This will be helpful when testing code fix verifiers that can handle multiple rules.
My intention is to use this in #650