chore: add GUT test framework

This commit is contained in:
xiaji
2026-05-29 09:16:10 +08:00
parent 5741ba1dc0
commit 07fc763413
808 changed files with 76903 additions and 0 deletions

View File

@@ -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()

View File

@@ -0,0 +1 @@
uid://c33phgfn2hbnd

View File

@@ -0,0 +1,5 @@
var value = 'start_value'
func _init(new_value='default_value'):
print("SUPER _init with value ", new_value)
value = new_value

View File

@@ -0,0 +1 @@
uid://d0a8we6yxjgw1

View 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

View File

@@ -0,0 +1 @@
uid://dwprio0yj17p2