Intialize environment
This commit is contained in:
6
client/addons/gut/double_templates/function_template.txt
Normal file
6
client/addons/gut/double_templates/function_template.txt
Normal file
@ -0,0 +1,6 @@
|
||||
{func_decleration}
|
||||
__gut_spy('{method_name}', {param_array})
|
||||
if(__gut_should_call_super('{method_name}', {param_array})):
|
||||
return {super_call}
|
||||
else:
|
||||
return __gut_get_stubbed_return('{method_name}', {param_array})
|
41
client/addons/gut/double_templates/script_template.txt
Normal file
41
client/addons/gut/double_templates/script_template.txt
Normal file
@ -0,0 +1,41 @@
|
||||
{extends}
|
||||
|
||||
var __gut_metadata_ = {
|
||||
path = '{path}',
|
||||
subpath = '{subpath}',
|
||||
stubber = __gut_instance_from_id({stubber_id}),
|
||||
spy = __gut_instance_from_id({spy_id}),
|
||||
gut = __gut_instance_from_id({gut_id}),
|
||||
}
|
||||
|
||||
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 _init():
|
||||
if(__gut_metadata_.gut != null):
|
||||
__gut_metadata_.gut.get_autofree().add_free(self)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Methods start here
|
||||
# ------------------------------------------------------------------------------
|
Reference in New Issue
Block a user