Skip to content

Commit 8602964

Browse files
committed
Force xunit to display diagnostics for a non-empty collection
1 parent 069b601 commit 8602964

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// 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.
2-
32
using System.Collections.Generic;
43
using System.IO;
54
using System.Runtime.CompilerServices;
5+
using System.Text;
66
using System.Threading.Tasks;
77
using System.Xml.Linq;
88
using ClangSharp.Interop;
@@ -75,7 +75,19 @@ private static async Task ValidateGeneratedBindingsAsync(string inputContents, s
7575

7676
if (expectedDiagnostics is null)
7777
{
78-
Assert.Empty(pinvokeGenerator.Diagnostics);
78+
var diagnostics = new StringBuilder();
79+
80+
foreach (var diagnostic in pinvokeGenerator.Diagnostics)
81+
{
82+
diagnostics = diagnostics.AppendLine(diagnostic.ToString());
83+
}
84+
85+
var diagnosticsString = diagnostics.ToString();
86+
87+
if (!string.IsNullOrEmpty(diagnosticsString))
88+
{
89+
throw new System.Exception(diagnosticsString);
90+
}
7991
}
8092
else
8193
{

0 commit comments

Comments
 (0)