private IEnumerator timeoutCheck() { LeanTester leanTester = null; float single = Time.realtimeSinceStartup + leanTester.timeout; while (Time.realtimeSinceStartup < single) { yield return(0); } if (!LeanTest.testsFinished) { UnityEngine.Debug.Log(LeanTest.formatB("Tests timed out!")); LeanTest.overview(); } }
public static void expect(bool didPass, string definition, string failExplaination = null) { float len = printOutLength(definition); int paddingLen = 40 - (int)(len * 1.05f); #if UNITY_FLASH string padding = padRight(paddingLen); #else string padding = "".PadRight(paddingLen, "_"[0]); #endif string logName = formatB(definition) + " " + padding + " [ " + (didPass ? formatC("pass", "green") : formatC("fail", "red")) + " ]"; if (didPass == false && failExplaination != null) { logName += " - " + failExplaination; } Debug.Log(logName); if (didPass) { passes++; } tests++; // Debug.Log("tests:"+tests+" expected:"+expected); if (tests == expected && testsFinished == false) { overview(); } else if (tests > expected) { Debug.Log(formatB("Too many tests for a final report!") + " set LeanTest.expected = " + tests); } if (timeoutStarted == false) { timeoutStarted = true; GameObject tester = new GameObject(); tester.name = "~LeanTest"; LeanTester test = tester.AddComponent(typeof(LeanTester)) as LeanTester; test.timeout = timeout; #if !UNITY_EDITOR tester.hideFlags = HideFlags.HideAndDontSave; #endif } }