提交 2e9e2afb 编写于 作者: C CyrusNajmabadi

Ensure the assembly IDs are actually correct.

上级 fc89871b
......@@ -97,7 +97,14 @@ public static TCompilation VerifyDiagnostics<TCompilation>(this TCompilation c,
{
var diagnostics = c.GetDiagnostics();
diagnostics.Verify(expected);
VerifyAssemblyIds(c, diagnostics);
return c;
}
private static void VerifyAssemblyIds<TCompilation>(
TCompilation c, ImmutableArray<Diagnostic> diagnostics) where TCompilation : Compilation
{
foreach (var diagnostic in diagnostics)
{
// If this is a diagnostic about a missing assembly, make sure that we can get back
......@@ -107,6 +114,12 @@ public static TCompilation VerifyDiagnostics<TCompilation>(this TCompilation c,
{
var assemblyIds = c.GetUnreferencedAssemblyIdentities(diagnostic);
Assert.True(assemblyIds.Length > 0);
var diagnosticMessage = diagnostic.GetMessage();
foreach (var id in assemblyIds)
{
Assert.Contains(id.GetDisplayName(), diagnosticMessage);
}
}
else
{
......@@ -114,8 +127,6 @@ public static TCompilation VerifyDiagnostics<TCompilation>(this TCompilation c,
Assert.True(assemblyIds.Length == 0);
}
}
return c;
}
public static void VerifyAnalyzerOccurrenceCount<TCompilation>(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册