diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs index 1e0cd713..948ff4c9 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. - using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; +using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using ClangSharp.Interop; @@ -75,7 +75,19 @@ private static async Task ValidateGeneratedBindingsAsync(string inputContents, s if (expectedDiagnostics is null) { - Assert.Empty(pinvokeGenerator.Diagnostics); + var diagnostics = new StringBuilder(); + + foreach (var diagnostic in pinvokeGenerator.Diagnostics) + { + diagnostics = diagnostics.AppendLine(diagnostic.ToString()); + } + + var diagnosticsString = diagnostics.ToString(); + + if (!string.IsNullOrEmpty(diagnosticsString)) + { + throw new System.Exception(diagnosticsString); + } } else {