diff options
author | Sven Boemer <sbomer@gmail.com> | 2021-09-29 18:29:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 18:29:52 +0300 |
commit | 640878adf1e27cb79bea0a894033f85a84db208d (patch) | |
tree | 25f26f9a0157d274f9e4f42df3f171e5446830dd /test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs | |
parent | d31e26ef3e552f1795c86a88c1451d36922e08f1 (diff) |
Analyzer test infra improvements (#2292)
* Improve analyzer test checker
- When diagnostics are missing, display all missing diagnostics
- Show candidate diagnostics that didn't match any expected ones
- Adjust match criteria to match Roslyn strings
- Clean up nullable annotations in test infra
- Remove cctor warnings from analyzer to match linker
- Remove redundant attribute property setter warnings
- Fix location filtering for warnings that originate from types
Diffstat (limited to 'test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs')
-rw-r--r-- | test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs index 54e13b846..10da5a5d9 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs @@ -786,10 +786,7 @@ class StaticCtor _ = new StaticCtor (); } }"; - return VerifyRequiresAssemblyFilesAnalyzer (src, - // (13,7): warning IL3002: Using member 'StaticCtor.StaticCtor()' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. Message for --TestStaticCtor--. - VerifyCS.Diagnostic (DiagnosticId.RequiresAssemblyFiles).WithSpan (13, 7, 13, 24).WithArguments ("StaticCtor.StaticCtor()", " Message for --TestStaticCtor--.", "") - ); + return VerifyRequiresAssemblyFilesAnalyzer (src); } [Fact] @@ -815,10 +812,7 @@ class C var x = StaticCtorTriggeredByFieldAccess.field + 1; } }"; - return VerifyRequiresAssemblyFilesAnalyzer (src, - // (18,11): warning IL3002: Using member 'StaticCtorTriggeredByFieldAccess.StaticCtorTriggeredByFieldAccess()' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app.. Message for --StaticCtorTriggeredByFieldAccess.Cctor--. - VerifyCS.Diagnostic (DiagnosticId.RequiresAssemblyFiles).WithSpan (18, 11, 18, 49).WithArguments ("StaticCtorTriggeredByFieldAccess.StaticCtorTriggeredByFieldAccess()", " Message for --StaticCtorTriggeredByFieldAccess.Cctor--.", "") - ); + return VerifyRequiresAssemblyFilesAnalyzer (src); } [Fact] @@ -849,9 +843,7 @@ class C }"; return VerifyRequiresAssemblyFilesAnalyzer (src, // (21,3): warning IL3002: Using member 'StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking()' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. Message for --StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--. - VerifyCS.Diagnostic (DiagnosticId.RequiresAssemblyFiles).WithSpan (21, 3, 21, 69).WithArguments ("StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking()", " Message for --StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--.", ""), - // (21,3): warning IL3002: Using member 'StaticCtorTriggeredByMethodCall.StaticCtorTriggeredByMethodCall()' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. Message for --StaticCtorTriggeredByMethodCall.Cctor--. - VerifyCS.Diagnostic (DiagnosticId.RequiresAssemblyFiles).WithSpan (21, 3, 21, 41).WithArguments ("StaticCtorTriggeredByMethodCall.StaticCtorTriggeredByMethodCall()", " Message for --StaticCtorTriggeredByMethodCall.Cctor--.", "") + VerifyCS.Diagnostic (DiagnosticId.RequiresAssemblyFiles).WithSpan (21, 3, 21, 69).WithArguments ("StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking()", " Message for --StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--.", "") ); } |