Add GUT (CLI only) and remove gd-plug

Commit GUT directly to the git repo and remove gd-plug as it is no
longer required to install GUT.

Modify GUT to be used by command-line only.

For example:
```
cp test/.gutconfig.ci.json .gutconfig.json
godot --no-window -s addons/gut/gut_cmdln.gd
```
This commit is contained in:
Leroy Hopson 2022-06-02 09:13:43 +07:00
parent b14ea64492
commit d784b53e25
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
52 changed files with 11394 additions and 1174 deletions

47
addons/gut/hook_script.gd Normal file
View file

@ -0,0 +1,47 @@
class_name GutHookScript
# ------------------------------------------------------------------------------
# This script is the base for custom scripts to be used in pre and post
# run hooks.
#
# To use, inherit from this script and then implement the run method.
# ------------------------------------------------------------------------------
var JunitXmlExport = load("res://addons/gut/junit_xml_export.gd")
# This is the instance of GUT that is running the tests. You can get
# information about the run from this object. This is set by GUT when the
# script is instantiated.
var gut = null
# the exit code to be used by gut_cmdln. See set method.
var _exit_code = null
var _should_abort = false
# Virtual method that will be called by GUT after instantiating
# this script.
func run():
gut.get_logger().error(
"Run method not overloaded. Create a 'run()' method in your hook script to run your code."
)
# Set the exit code when running from the command line. If not set then the
# default exit code will be returned (0 when no tests fail, 1 when any tests
# fail).
func set_exit_code(code):
_exit_code = code
func get_exit_code():
return _exit_code
# Usable by pre-run script to cause the run to end AFTER the run() method
# finishes. post-run script will not be ran.
func abort():
_should_abort = true
func should_abort():
return _should_abort