mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-09 05:35:31 +02:00
Update Gut for Godot 4
Copied from Gut repo godot_4 branch commit: ba19a4c1b6f88160641a67a39729144046c6391f
This commit is contained in:
parent
44f7e3801c
commit
b5d3c6c9a5
105 changed files with 8545 additions and 5750 deletions
|
@ -1,6 +1,6 @@
|
|||
{func_decleration}
|
||||
__gut_spy('{method_name}', {param_array})
|
||||
if(__gut_should_call_super('{method_name}', {param_array})):
|
||||
__gutdbl.spy_on('{method_name}', {param_array})
|
||||
if(__gutdbl.should_call_super('{method_name}', {param_array})):
|
||||
return {super_call}
|
||||
else:
|
||||
return __gut_get_stubbed_return('{method_name}', {param_array})
|
||||
return __gutdbl.get_stubbed_return('{method_name}', {param_array})
|
||||
|
|
4
addons/gut/double_templates/init_template.txt
Normal file
4
addons/gut/double_templates/init_template.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
{func_decleration}:
|
||||
super({super_params})
|
||||
__gutdbl.spy_on('{method_name}', {param_array})
|
||||
|
|
@ -1,59 +1,31 @@
|
|||
# ##############################################################################
|
||||
# Start Script
|
||||
# Gut Doubled Script
|
||||
# ##############################################################################
|
||||
{extends}
|
||||
|
||||
{constants}
|
||||
|
||||
{properties}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# GUT Double properties and methods
|
||||
# GUT stuff
|
||||
# ------------------------------------------------------------------------------
|
||||
var __gut_metadata_ = {
|
||||
path = '{path}',
|
||||
var __gutdbl_values = {
|
||||
double = self,
|
||||
thepath = '{path}',
|
||||
subpath = '{subpath}',
|
||||
stubber = __gut_instance_from_id({stubber_id}),
|
||||
spy = __gut_instance_from_id({spy_id}),
|
||||
gut = __gut_instance_from_id({gut_id}),
|
||||
stubber = {stubber_id},
|
||||
spy = {spy_id},
|
||||
gut = {gut_id},
|
||||
from_singleton = '{singleton_name}',
|
||||
is_partial = {is_partial}
|
||||
is_partial = {is_partial},
|
||||
}
|
||||
var __gutdbl = load('res://addons/gut/double_tools.gd').new(__gutdbl_values)
|
||||
|
||||
func __gut_instance_from_id(inst_id):
|
||||
if(inst_id == -1):
|
||||
return null
|
||||
else:
|
||||
return instance_from_id(inst_id)
|
||||
|
||||
func __gut_should_call_super(method_name, called_with):
|
||||
if(__gut_metadata_.stubber != null):
|
||||
return __gut_metadata_.stubber.should_call_super(self, method_name, called_with)
|
||||
else:
|
||||
return false
|
||||
|
||||
var __gut_utils_ = load('res://addons/gut/utils.gd').get_instance()
|
||||
|
||||
func __gut_spy(method_name, called_with):
|
||||
if(__gut_metadata_.spy != null):
|
||||
__gut_metadata_.spy.add_call(self, method_name, called_with)
|
||||
|
||||
func __gut_get_stubbed_return(method_name, called_with):
|
||||
if(__gut_metadata_.stubber != null):
|
||||
return __gut_metadata_.stubber.get_return(self, method_name, called_with)
|
||||
else:
|
||||
return null
|
||||
|
||||
func __gut_default_val(method_name, p_index):
|
||||
if(__gut_metadata_.stubber != null):
|
||||
return __gut_metadata_.stubber.get_default_value(self, method_name, p_index)
|
||||
else:
|
||||
return null
|
||||
|
||||
|
||||
func _init():
|
||||
if(__gut_metadata_.gut != null):
|
||||
__gut_metadata_.gut.get_autofree().add_free(self)
|
||||
# Here so other things can check for a method to know if this is a double.
|
||||
func __gutdbl_check_method__():
|
||||
pass
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Methods start here
|
||||
# Doubled Methods
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue