chore: add GUT test framework
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# this class is used by test_stubber and represents a doubled object
|
||||
# which is why we have __gutdbl in here.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
var __gutdbl_values = {
|
||||
thepath = 'res://test/resources/stub_test_objects/to_stub.gd',
|
||||
subpath = '',
|
||||
stubber = -1,
|
||||
spy = -1,
|
||||
gut = -1,
|
||||
singleton_name = '',
|
||||
singleton = -1,
|
||||
is_partial = false,
|
||||
}
|
||||
|
||||
var __gutdbl = load('res://addons/gut/double_tools.gd').new(self)
|
||||
|
||||
# Here so other things can check for a method to know if this is a double.
|
||||
func __gutdbl_check_method__():
|
||||
pass
|
||||
|
||||
# Cleanup called by GUT after tests have finished. Important for RefCounted
|
||||
# objects. Nodes are freed, and won't have this method called on them.
|
||||
func __gutdbl_done():
|
||||
__gutdbl = null
|
||||
__gutdbl_values.clear()
|
||||
@@ -0,0 +1 @@
|
||||
uid://c33phgfn2hbnd
|
||||
@@ -0,0 +1,5 @@
|
||||
var value = 'start_value'
|
||||
|
||||
func _init(new_value='default_value'):
|
||||
print("SUPER _init with value ", new_value)
|
||||
value = new_value
|
||||
@@ -0,0 +1 @@
|
||||
uid://d0a8we6yxjgw1
|
||||
40
addons/gut/test/resources/stub_test_objects/to_stub.gd
Normal file
40
addons/gut/test/resources/stub_test_objects/to_stub.gd
Normal file
@@ -0,0 +1,40 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# this class is used by test_stubber and represents a doubled object.
|
||||
# This top section must be kept in line with script_template.txt
|
||||
# ------------------------------------------------------------------------------
|
||||
var __gutdbl_values = {
|
||||
thepath = 'res://test/resources/stub_test_objects/to_stub.gd',
|
||||
subpath = '',
|
||||
stubber = -1,
|
||||
spy = -1,
|
||||
gut = -1,
|
||||
singleton_name = '',
|
||||
singleton = -1,
|
||||
is_partial = false,
|
||||
}
|
||||
var __gutdbl = load('res://addons/gut/double_tools.gd').new(self)
|
||||
|
||||
# Here so other things can check for a method to know if this is a double.
|
||||
func __gutdbl_check_method__():
|
||||
pass
|
||||
|
||||
|
||||
# Cleanup called by GUT after tests have finished. Important for RefCounted
|
||||
# objects. Nodes are freed, and won't have this method called on them.
|
||||
func __gutdbl_done():
|
||||
__gutdbl = null
|
||||
__gutdbl_values.clear()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# These are some methods and vars to be used in tests.
|
||||
# ------------------------------------------------------------------------------
|
||||
var value = 4
|
||||
func get_value():
|
||||
return value
|
||||
|
||||
func set_value(val):
|
||||
value = val
|
||||
|
||||
|
||||
func default_value_method(p1='a'):
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
uid://dwprio0yj17p2
|
||||
Reference in New Issue
Block a user