LogAssert.cs
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}
}
}
}