| 1 |
# ------------------------------------------------------------------------------ |
| 2 |
# This script is the base for custom scripts to be used in pre and post |
| 3 |
# run hooks. |
| 4 |
# ------------------------------------------------------------------------------ |
| 5 |
|
| 6 |
# This is the instance of GUT that is running the tests. You can get |
| 7 |
# information about the run from this object. This is set by GUT when the |
| 8 |
# script is instantiated. |
| 9 |
var gut = null |
| 10 |
|
| 11 |
# the exit code to be used by gut_cmdln. See set method. |
| 12 |
var _exit_code = null |
| 13 |
|
| 14 |
var _should_abort = false |
| 15 |
# Virtual method that will be called by GUT after instantiating |
| 16 |
# this script. |
| 17 |
func run(): |
| 18 |
pass |
| 19 |
|
| 20 |
# Set the exit code when running from the command line. If not set then the |
| 21 |
# default exit code will be returned (0 when no tests fail, 1 when any tests |
| 22 |
# fail). |
| 23 |
func set_exit_code(code): |
| 24 |
_exit_code = code |
| 25 |
|
| 26 |
func get_exit_code(): |
| 27 |
return _exit_code |
| 28 |
|
| 29 |
# Usable by pre-run script to cause the run to end AFTER the run() method |
| 30 |
# finishes. post-run script will not be ran. |
| 31 |
func abort(): |
| 32 |
_should_abort = true |
| 33 |
|
| 34 |
func should_abort(): |
| 35 |
return _should_abort |