You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now in order to test diagnostic suppressor it is required to use code instead of more visual markup. It might be a good thing to add a pair of markup rules to express this directly there instead of having to dive into code. Therefore I suggest the following:
if a named span ends with ? treat it as suppressed diagnostic name
if a named span ends with ! verify that this diagnostic is not suppressed
Consider the following example:
[Fact]publicasyncTaskTest1(){varsource=""" class C { public string {|#0:Prop|} { get; set; } public string {|#1:OtherProp|} { get; set; } } """;awaitnewMyAnalyzerVerifier<MySuppressor>.Test{TestCode=source,ExpectedDiagnostics={DiagnosticResult.CompilerWarning("CS8618").WithLocation(0).WithLocation(0).WithIsSuppressed(true)
DiagnosticResult.CompilerWarning("CS8618").WithLocation(1).WithLocation(1).WithIsSuppressed(false)},CompilerDiagnostics=CompilerDiagnostics.Warnings}.RunAsync();}
Using proposed rules this test can be simplified to:
[Fact]publicasyncTaskTest1(){varsource=""" class C { public string {|CS8618?:Prop|} { get; set; } public string {|CS8618!:OtherProp|} { get; set; } } """;awaitnewMyAnalyzerVerifier<MySuppressor>.Test{TestCode=source,CompilerDiagnostics=CompilerDiagnostics.Warnings}.RunAsync();}
Not a big deal, just a little quality of life thing.
The text was updated successfully, but these errors were encountered:
Right now in order to test diagnostic suppressor it is required to use code instead of more visual markup. It might be a good thing to add a pair of markup rules to express this directly there instead of having to dive into code. Therefore I suggest the following:
?
treat it as suppressed diagnostic name!
verify that this diagnostic is not suppressedConsider the following example:
Using proposed rules this test can be simplified to:
Not a big deal, just a little quality of life thing.
The text was updated successfully, but these errors were encountered: