mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
45 lines
No EOL
1.2 KiB
C#
45 lines
No EOL
1.2 KiB
C#
using System.Diagnostics;
|
|
using System.Linq;
|
|
using LibHac.Diag;
|
|
using LibHac.Tests;
|
|
using Xunit.Abstractions;
|
|
using Xunit.Sdk;
|
|
|
|
[assembly: Xunit.TestFramework("LibHac.Tests." + nameof(LibHacTestFramework), "LibHac.Tests")]
|
|
|
|
namespace LibHac.Tests;
|
|
|
|
public class LibHacTestFramework : XunitTestFramework
|
|
{
|
|
public LibHacTestFramework(IMessageSink messageSink)
|
|
: base(messageSink)
|
|
{
|
|
SetDebugHandler();
|
|
SetResultNames();
|
|
}
|
|
|
|
// Todo: Catch assertions in PathToolTestGenerator.cpp
|
|
private static readonly string[] SkipAbortFunctions = { "Normalize" };
|
|
|
|
private static void SetDebugHandler()
|
|
{
|
|
AssertionFailureHandler handler = (in AssertionInfo info) =>
|
|
{
|
|
if (SkipAbortFunctions.Contains(info.FunctionName))
|
|
{
|
|
return AssertionFailureOperation.Continue;
|
|
}
|
|
|
|
return AssertionFailureOperation.Abort;
|
|
};
|
|
|
|
Assert.SetAssertionFailureHandler(handler);
|
|
Trace.Listeners.Clear();
|
|
Trace.Listeners.Add(new DebugAssertHandler());
|
|
}
|
|
|
|
private static void SetResultNames()
|
|
{
|
|
Result.SetNameResolver(new ResultNameResolver());
|
|
}
|
|
} |