Files
Magical-Jumping-Bean/Library/metadata/4b/4bbc17b35884fdf468e4b52ae4222882
T

231 lines
12 KiB
Plaintext
Raw Normal View History

2019-09-29 19:40:54 -04:00
í2019.2.3f1þÿÿÿÿÿ’3$øÌuñ옲e+ Í=^7€ÿÿÿÿ¦€²Ð¦¦¦€#¦€+H€3ÿÿÿÿ1€1€ÿÿÿÿ@Þ Q€j
H€<ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jÕ€Iÿÿÿÿ1€1€ÿÿÿÿÀÞH€j€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€j€PAssetMetaDataguiddata[0]data[1]data[2]data[3]pathNameoriginalNamelabelsassetStoreRef ÿÿfš†!ë5˜9Ý4QÁóBí7€ÿÿÿÿ¦€²
E Þ€#.€,5a Þ€#.€,€r Þ€# .€,
H€«€ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jñ€JÿÿÿÿÀ1€1€ÿÿÿÿÞ€j€ÿÿÿÿ\€ÿÿÿÿH€rÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jH€wÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jH€€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jy
 Þ€#!.€,"€…ÿÿÿÿ#@1€1€ÿÿÿÿ$Þ%.€j&Õ€“ÿÿÿÿ'1€1€ÿÿÿÿ(ÀÞ)€j€ÿÿÿÿ*H€›€ÿÿÿÿ+1€1€ÿÿÿÿ,@Þ-Q€j.y
 /Þ€#0.€,1 €§2@¾€¶ 3@Þ€#4.€,5H€»ÿÿÿÿ61€1€ÿÿÿÿ7@Þ8Q€j9H€Æÿÿÿÿ:1€1€ÿÿÿÿ;@Þ<Q€j=H€Øÿÿÿÿ>1€1€ÿÿÿÿ?@Þ@Q€jAMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariantsÿÿ£Gñ×ÜZ56 :!@iÁJ*€7€ÿÿÿÿ¦€²E Þ.(a Þ.€r Þ .
H€«€ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jH€ê€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jñ€=ÿÿÿÿ1€1€ÿÿÿÿÞ€j€ÿÿÿÿH€›€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jy
 Þ.y€Q Þ. Þ€X!H€iÿÿÿÿ"1€1€ÿÿÿÿ#@Þ$Q€j%H€uÿÿÿÿ&1€1€ÿÿÿÿ'@Þ(Q€j)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespace\ày¯à´Ëq;…HßO†N[¢N"(XPackages/com.unity.test-framework/UnityEngine.TestRunner/Assertions/LogScope/LogScope.csày¯LogScope‡using System;
using System.Collections.Generic;
using System.Linq;
namespace UnityEngine.TestTools.Logging
{
internal class LogScope : IDisposable
{
private bool m_Disposed;
private readonly object _lock = new object();
public Queue<LogMatch> ExpectedLogs { get; set; }
public List<LogEvent> AllLogs { get; }
public List<LogEvent> FailingLogs { get; }
public bool IgnoreFailingMessages { get; set; }
public bool IsNUnitException { get; private set; }
public bool IsNUnitSuccessException { get; private set; }
public bool IsNUnitInconclusiveException { get; private set; }
public bool IsNUnitIgnoreException { get; private set; }
public string NUnitExceptionMessage { get; private set; }
private bool m_NeedToProcessLogs;
private static List<LogScope> s_ActiveScopes = new List<LogScope>();
internal static LogScope Current
{
get
{
if (s_ActiveScopes.Count == 0)
throw new InvalidOperationException("No log scope is available");
return s_ActiveScopes[0];
}
}
internal static bool HasCurrentLogScope()
{
return s_ActiveScopes.Count > 0;
}
public LogScope()
{
AllLogs = new List<LogEvent>();
FailingLogs = new List<LogEvent>();
ExpectedLogs = new Queue<LogMatch>();
IgnoreFailingMessages = false;
Activate();
}
private void Activate()
{
s_ActiveScopes.Insert(0, this);
RegisterScope(this);
Application.logMessageReceivedThreaded -= AddLog;
Application.logMessageReceivedThreaded += AddLog;
}
private void Deactivate()
{
Application.logMessageReceivedThreaded -= AddLog;
s_ActiveScopes.Remove(this);
UnregisterScope(this);
}
private static void RegisterScope(LogScope logScope)
{
Application.logMessageReceivedThreaded += logScope.AddLog;
}
private static void UnregisterScope(LogScope logScope)
{
Application.logMessageReceivedThreaded -= logScope.AddLog;
}
public void AddLog(string message, string stacktrace, LogType type)
{
lock (_lock)
{
m_NeedToProcessLogs = true;
var log = new LogEvent
{
LogType = type,
Message = message,
StackTrace = stacktrace,
};
AllLogs.Add(log);
if (IsNUnitResultStateException(stacktrace, type))
{
if (message.StartsWith("SuccessException"))
{
IsNUnitException = true;
IsNUnitSuccessException = true;
if (message.StartsWith("SuccessException: "))
{
NUnitExceptionMessage = message.Substring("SuccessException: ".Length);
return;
}
}
else if (message.StartsWith("InconclusiveException"))
{
IsNUnitException = true;
IsNUnitInconclusiveException = true;
if (message.StartsWith("InconclusiveException: "))
{
NUnitExceptionMessage = message.Substring("InconclusiveException: ".Length);
return;
}
}
else if (message.StartsWith("IgnoreException"))
{
IsNUnitException = true;
IsNUnitIgnoreException = true;
if (message.StartsWith("IgnoreException: "))
{
NUnitExceptionMessage = message.Substring("IgnoreException: ".Length);
return;
}
}
}
if (IsFailingLog(type) && !IgnoreFailingMessages)
{
FailingLogs.Add(log);
}
}
}
public bool IsAllLogsHandled()
{
lock (_lock)
{
return AllLogs.All(x => x.IsHandled);
}
}
public LogEvent GetUnhandledLog()
{
lock (_lock)
{
return AllLogs.First(x => !x.IsHandled);
}
}
private static bool IsNUnitResultStateException(string stacktrace, LogType logType)
{
if (logType != LogType.Exception)
return false;
return string.IsNullOrEmpty(stacktrace) || stacktrace.StartsWith("NUnit.Framework.Assert.");
}
private static bool IsFailingLog(LogType type)
{
switch (type)
{
case LogType.Assert:
case LogType.Error:
case LogType.Exception:
return true;
default:
return false;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (m_Disposed)
{
return;
}
m_Disposed = true;
if (disposing)
{
Deactivate();
}
}
internal bool AnyFailingLogs()
{
ProcessExpectedLogs();
return FailingLogs.Any();
}
internal void ProcessExpectedLogs()
{
lock (_lock)
{
if (!m_NeedToProcessLogs || !ExpectedLogs.Any())
return;
LogMatch expectedLog = null;
foreach (var logEvent in AllLogs)
{
if (!ExpectedLogs.Any())
break;
if (expectedLog == null && ExpectedLogs.Any())
expectedLog = ExpectedLogs.Peek();
if (expectedLog != null && expectedLog.Matches(logEvent))
{
ExpectedLogs.Dequeue();
logEvent.IsHandled = true;
if (FailingLogs.Any(expectedLog.Matches))
{
var failingLog = FailingLogs.First(expectedLog.Matches);
FailingLogs.Remove(failingLog);
}
expectedLog = null;
}
}
m_NeedToProcessLogs = false;
}