jump-game/Jump Game/Library/PackageCache/com.unity.test-framework@1.0.13/UnityEngine.TestRunner/Assertions/LogAssert.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2020-01-29 08:05:38 +00:00
using System.Text.RegularExpressions;
using UnityEngine.TestTools.Logging;
using UnityEngine.TestTools.TestRunner;
namespace UnityEngine.TestTools
{
public static class LogAssert
{
public static void Expect(LogType type, string message)
{
LogScope.Current.ExpectedLogs.Enqueue(new LogMatch() { LogType = type, Message = message });
}
public static void Expect(LogType type, Regex message)
{
LogScope.Current.ExpectedLogs.Enqueue(new LogMatch() { LogType = type, MessageRegex = message });
}
public static void NoUnexpectedReceived()
{
LogScope.Current.ProcessExpectedLogs();
var isAllLogsHandled = LogScope.Current.IsAllLogsHandled();
if (isAllLogsHandled)
{
return;
}
var unhandledLog = LogScope.Current.GetUnhandledLog();
throw new UnhandledLogMessageException(unhandledLog);
}
public static bool ignoreFailingMessages
{
get
{
return LogScope.Current.IgnoreFailingMessages;
}
set
{
LogScope.Current.IgnoreFailingMessages = value;
}
}
}
}