LogAssert.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Text.RegularExpressions;
  2. using UnityEngine.TestTools.Logging;
  3. namespace UnityEngine.TestTools
  4. {
  5. public static class LogAssert
  6. {
  7. public static void Expect(LogType type, string message)
  8. {
  9. LogScope.Current.ExpectedLogs.Enqueue(new LogMatch() { LogType = type, Message = message });
  10. }
  11. public static void Expect(LogType type, Regex message)
  12. {
  13. LogScope.Current.ExpectedLogs.Enqueue(new LogMatch() { LogType = type, MessageRegex = message });
  14. }
  15. public static void NoUnexpectedReceived()
  16. {
  17. LogScope.Current.NoUnexpectedReceived();
  18. }
  19. public static bool ignoreFailingMessages
  20. {
  21. get
  22. {
  23. return LogScope.Current.IgnoreFailingMessages;
  24. }
  25. set
  26. {
  27. if (value != LogScope.Current.IgnoreFailingMessages)
  28. {
  29. Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "\nIgnoreFailingMessages:" + (value? "true":"false"));
  30. }
  31. LogScope.Current.IgnoreFailingMessages = value;
  32. }
  33. }
  34. }
  35. }