summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs')
-rw-r--r--Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs80
1 files changed, 0 insertions, 80 deletions
diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs
deleted file mode 100644
index 3ade433..0000000
--- a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using System;
-using System.IO;
-using UnityEditor.TestRunner.CommandLineParser;
-using UnityEditor.TestTools.TestRunner.Api;
-using UnityEngine;
-
-namespace UnityEditor.TestTools.TestRunner.CommandLineTest
-{
- [InitializeOnLoad]
- static class TestStarter
- {
- static TestStarter()
- {
- if (!ShouldRunTests())
- {
- return;
- }
-
- if (EditorApplication.isCompiling)
- {
- return;
- }
-
- executer.ExitOnCompileErrors();
-
- if (RunData.instance.isRunning)
- {
- executer.SetUpCallbacks(RunData.instance.executionSettings);
- return;
- }
-
- EditorApplication.update += UpdateWatch;
- }
-
- static void UpdateWatch()
- {
- EditorApplication.update -= UpdateWatch;
-
- if (RunData.instance.isRunning)
- {
- return;
- }
-
- RunData.instance.isRunning = true;
- var commandLineArgs = Environment.GetCommandLineArgs();
- RunData.instance.executionSettings = executer.BuildExecutionSettings(commandLineArgs);
- executer.SetUpCallbacks(RunData.instance.executionSettings);
- executer.InitializeAndExecuteRun(commandLineArgs);
- }
-
- static bool ShouldRunTests()
- {
- var shouldRunTests = false;
- var optionSet = new CommandLineOptionSet(
- new CommandLineOption("runTests", () => { shouldRunTests = true; }),
- new CommandLineOption("runEditorTests", () => { shouldRunTests = true; })
- );
- optionSet.Parse(Environment.GetCommandLineArgs());
- return shouldRunTests;
- }
-
- static Executer s_Executer;
-
- static Executer executer
- {
- get
- {
- if (s_Executer == null)
- {
- Func<bool> compilationCheck = () => EditorUtility.scriptCompilationFailed;
- Action<string> actionLogger = (string msg) => { Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, msg); };
- var apiSettingsBuilder = new SettingsBuilder(new TestSettingsDeserializer(() => new TestSettings()), actionLogger, Debug.LogWarning, File.Exists, compilationCheck);
- s_Executer = new Executer(ScriptableObject.CreateInstance<TestRunnerApi>(), apiSettingsBuilder, Debug.LogErrorFormat, Debug.LogException, EditorApplication.Exit, compilationCheck);
- }
-
- return s_Executer;
- }
- }
- }
-}