Exemplo n.º 1
0
        public void TestTrimWrongStackTrace()
        {
            string stackTrace = "LunarPlugin.Log:StackTrace(Int32) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:365)";
            string expected   = "";

            string actual = CStackTrace.ExtractStackTrace(stackTrace, 3);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void TestTrimStackTraceWithLineBreakAtTheEnd()
        {
            string stackTrace = "LunarPlugin.Log:StackTrace(Int32) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:365)\n";
            string expected   = "";

            string actual = CStackTrace.ExtractStackTrace(stackTrace, 1);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void TestTrimTooManyFrames()
        {
            string stackTrace = "LunarPlugin.Log:StackTrace(Int32) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:365)\n" +
                                "LunarPlugin.Log:LogMessage(Tag, LogLevel, String) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:296)\n" +
                                "LunarPlugin.Log:d(String, Object[]) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:198)";

            string expected = "";

            string actual = CStackTrace.ExtractStackTrace(stackTrace, 4);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void TestTrimFrames()
        {
            string stackTrace = "LunarPlugin.Log:StackTrace(Int32) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:365)\n" +
                                "LunarPlugin.Log:LogMessage(Tag, LogLevel, String) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:296)\n" +
                                "LunarPlugin.Log:d(String, Object[]) (at Assets/Plugins/LunarPlugin/Debugging/Log.cs:198)\n" +
                                "LunarPlugin.Cmd_echo:Execute(String[]) (at Assets/Plugins/LunarPlugin/Console/CConsole_common.cs:329)\n" +
                                "LunarPlugin.CCommand:ExecuteGuarded(List`1, String) (at Assets/Plugins/LunarPlugin/Console/CCommand.cs:147)\n" +
                                "LunarPlugin.CCommand:ExecuteTokens(List`1, String) (at Assets/Plugins/LunarPlugin/Console/CCommand.cs:75)\n" +
                                "LunarPlugin.CommandProcessor:TryExecute(String) (at Assets/Plugins/LunarPlugin/Console/CommandProcessor.cs:35)\n" +
                                "LunarPlugin.App:ExecCommand(String) (at Assets/Plugins/LunarPlugin/App.cs:273)\n" +
                                "TerminalWindow:<CreateUI>m__2(TextField, KeyCode, Boolean) (at Assets/Editor/TerminalWindow.cs:48)\n" +
                                "LunarPlugin.TextField:OnGUI() (at Assets/Plugins/LunarPlugin/UI/TextField.cs:69)\n" +
                                "LunarPlugin.View:DrawChildren(Boolean) (at Assets/Plugins/LunarPlugin/UI/View.cs:392)\n" +
                                "LunarPlugin.View:DrawGUI() (at Assets/Plugins/LunarPlugin/UI/View.cs:70)\n" +
                                "LunarPlugin.View:OnGUI() (at Assets/Plugins/LunarPlugin/UI/View.cs:62)\n" +
                                "Window:OnGUI() (at Assets/Editor/Window.cs:37)\n" +
                                "System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)\n" +
                                "System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)\n" +
                                "System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)\n" +
                                "UnityEditor.HostView:Invoke(String, Object)\n" +
                                "UnityEditor.HostView:Invoke(String)\n" +
                                "UnityEditor.DockArea:OnGUI()";

            string expected = "LunarPlugin.Cmd_echo:Execute(String[]) (at Assets/Plugins/LunarPlugin/Console/CConsole_common.cs:329)\n" +
                              "LunarPlugin.CCommand:ExecuteGuarded(List`1, String) (at Assets/Plugins/LunarPlugin/Console/CCommand.cs:147)\n" +
                              "LunarPlugin.CCommand:ExecuteTokens(List`1, String) (at Assets/Plugins/LunarPlugin/Console/CCommand.cs:75)\n" +
                              "LunarPlugin.CommandProcessor:TryExecute(String) (at Assets/Plugins/LunarPlugin/Console/CommandProcessor.cs:35)\n" +
                              "LunarPlugin.App:ExecCommand(String) (at Assets/Plugins/LunarPlugin/App.cs:273)\n" +
                              "TerminalWindow:<CreateUI>m__2(TextField, KeyCode, Boolean) (at Assets/Editor/TerminalWindow.cs:48)\n" +
                              "LunarPlugin.TextField:OnGUI() (at Assets/Plugins/LunarPlugin/UI/TextField.cs:69)\n" +
                              "LunarPlugin.View:DrawChildren(Boolean) (at Assets/Plugins/LunarPlugin/UI/View.cs:392)\n" +
                              "LunarPlugin.View:DrawGUI() (at Assets/Plugins/LunarPlugin/UI/View.cs:70)\n" +
                              "LunarPlugin.View:OnGUI() (at Assets/Plugins/LunarPlugin/UI/View.cs:62)\n" +
                              "Window:OnGUI() (at Assets/Editor/Window.cs:37)\n" +
                              "System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)\n" +
                              "System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)\n" +
                              "System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)\n" +
                              "UnityEditor.HostView:Invoke(String, Object)\n" +
                              "UnityEditor.HostView:Invoke(String)\n" +
                              "UnityEditor.DockArea:OnGUI()";

            string actual = CStackTrace.ExtractStackTrace(stackTrace, 3);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
 internal static void LogMessage(CTag tag, CLogLevel level, string message)
 {
     LogMessage(tag, level, message, CStackTrace.ExtractStackTrace(3));
 }