< Summary

Class:GDX.Developer.ConsoleCommands.QuitConsoleCommand
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/QuitConsoleCommand.cs
Covered lines:3
Uncovered lines:20
Coverable lines:23
Total lines:62
Line coverage:13% (3 of 23)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:5
Method coverage:20% (1 of 5)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Evaluate(...)0%2100%
GetAccessLevel()0%2100%
GetKeyword()0%110100%
GetHelpMessage()0%2100%
GetInstance(...)0%6200%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/QuitConsoleCommand.cs

#LineLine coverage
 1// Copyright (c) 2020-2022 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using UnityEditor;
 6#if !UNITY_EDITOR
 7using UnityEngine;
 8#endif
 9
 10namespace GDX.Developer.ConsoleCommands
 11{
 12#if UNITY_2022_2_OR_NEWER
 13    public class QuitConsoleCommand : ConsoleCommandBase
 14    {
 15        int m_ErrorCode;
 16
 17        /// <inheritdoc />
 18        public override bool Evaluate(float deltaTime)
 019        {
 020            UnityEngine.Debug.Log($"Quitting! [{m_ErrorCode}]");
 21#if UNITY_EDITOR
 022            EditorApplication.isPlaying = false;
 23#else
 24            Application.Quit(m_ErrorCode);
 25#endif
 026            return true;
 027        }
 28
 29        /// <inheritdoc />
 30        public override Console.ConsoleAccessLevel GetAccessLevel()
 031        {
 032            return Console.ConsoleAccessLevel.Anonymous;
 033        }
 34
 35        /// <inheritdoc />
 36        public override string GetKeyword()
 737        {
 738            return "quit";
 739        }
 40
 41        /// <inheritdoc />
 42        public override string GetHelpMessage()
 043        {
 044            return "Exits the application with the provided error code, if none is present will use the currently set on
 045        }
 46
 47        /// <inheritdoc />
 48        public override ConsoleCommandBase GetInstance(string context)
 049        {
 050            QuitConsoleCommand command = new QuitConsoleCommand();
 051            if (string.IsNullOrEmpty(context))
 052            {
 053                return command;
 54            }
 55
 056            int.TryParse(context, out int result);
 057            command.m_ErrorCode = result;
 058            return command;
 059        }
 60    }
 61#endif // UNITY_2022_2_OR_NEWER
 62}

Coverage by test methods







Methods/Properties

Evaluate(System.Single)
GetAccessLevel()
GetKeyword()
GetHelpMessage()
GetInstance(System.String)