Skip to content

Commit

Permalink
Force xunit to display diagnostics for a non-empty collection
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Aug 4, 2021
1 parent 4f7af5d commit e0e1e04
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit e0e1e04

Please sign in to comment.