提交 c16f7d86 编写于 作者: J Jason Malinowski

Assert our tests don't accidentally have compiler errors in them

This is just to prevent tests from not doing what we expected them to
do for the reason we thought.
上级 1967d755
......@@ -13,9 +13,9 @@ Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests
<Theory>
<InlineData("class C { [|string|] s; }", "mscorlib#T:System.String", WellKnownSymbolMonikerSchemes.DotnetXmlDoc)>
<InlineData("class C { void M() { [|M|](); }", TestProjectAssemblyName + "#M:C.M", WellKnownSymbolMonikerSchemes.DotnetXmlDoc)>
<InlineData("class C { void M(string s) { M([|s|]) }", TestProjectAssemblyName + "#M:C.M(System.String)#s", WellKnownSymbolMonikerSchemes.DotnetXmlDoc)>
<InlineData("class C { void M(string s) { string local; M([|local|]) }", Nothing, Nothing)>
<InlineData("class C { void M() { [|M|](); } }", TestProjectAssemblyName + "#M:C.M", WellKnownSymbolMonikerSchemes.DotnetXmlDoc)>
<InlineData("class C { void M(string s) { M([|s|]); } }", TestProjectAssemblyName + "#M:C.M(System.String)#s", WellKnownSymbolMonikerSchemes.DotnetXmlDoc)>
<InlineData("class C { void M(string s) { string local = """"; M([|local|]); } }", Nothing, Nothing)>
<InlineData("class C { void M(string s) { M(s [|+|] s) }", Nothing, Nothing)>
<InlineData("using [|S|] = System.String;", Nothing, Nothing)>
<InlineData("class C { [|global|]::System.String s; }", "<global namespace>", WellKnownSymbolMonikerSchemes.DotnetNamespace)>
......@@ -49,7 +49,9 @@ Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests
<Document Name="A.cs" FilePath="Z:\A.cs">
<%= code %>
</Document>
<ProjectReference Alias="A">ReferencedWithAlias</ProjectReference>
</Project>
<Project AssemblyName="ReferencedWithAlias" Language="C#" FilePath="Z:\ReferencedWithAlias.csproj"></Project>
</Workspace>))
Assert.Empty(lsif.Vertices.OfType(Of Range))
......
......@@ -30,6 +30,10 @@ Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests.U
For Each project In workspace.CurrentSolution.Projects
Dim compilation = Await project.GetCompilationAsync()
' Assert we don't have any errors to prevent any typos in the tests
Assert.Empty(compilation.GetDiagnostics().Where(Function(d) d.Severity = DiagnosticSeverity.Error))
generator.GenerateForCompilation(compilation, project.FilePath, project.LanguageServices)
Next
End Function
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册