GlobalGameJame/Library/PackageCache/com.unity.test-framework@1.1.9/UnityEngine.TestRunner/Assertions/LogAssert.cs

40 lines
1.2 KiB
C#
Raw Normal View History

2020-01-31 15:10:04 +00:00
using System.Text.RegularExpressions;
using UnityEngine.TestTools.Logging;
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.NoUnexpectedReceived();
}
public static bool ignoreFailingMessages
{
get
{
return LogScope.Current.IgnoreFailingMessages;
}
set
{
if (value != LogScope.Current.IgnoreFailingMessages)
{
Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "\nIgnoreFailingMessages:" + (value? "true":"false"));
}
LogScope.Current.IgnoreFailingMessages = value;
}
}
}
}