diff options
| author | Sophia Pearson <codergal89@gmail.com> | 2022-09-05 20:35:53 +0200 |
|---|---|---|
| committer | Sophia Pearson <codergal89@gmail.com> | 2022-09-05 20:35:53 +0200 |
| commit | f20bd89dc4a7bf14a88b1effcaa1887b29314525 (patch) | |
| tree | d114787f68efd2a7d61d95fa9c84e8e5d69a7c11 /addons/gut/stub_params.gd | |
| parent | 1b477b62f8be8c546a35dbd1d2688ebf623c496f (diff) | |
| download | texty-f20bd89dc4a7bf14a88b1effcaa1887b29314525.tar.xz texty-f20bd89dc4a7bf14a88b1effcaa1887b29314525.zip | |
gui: split GUI into Terminal components
Diffstat (limited to 'addons/gut/stub_params.gd')
| -rw-r--r-- | addons/gut/stub_params.gd | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/addons/gut/stub_params.gd b/addons/gut/stub_params.gd index d52d9b2..1048488 100644 --- a/addons/gut/stub_params.gd +++ b/addons/gut/stub_params.gd @@ -1,3 +1,6 @@ +var _utils = load('res://addons/gut/utils.gd').get_instance() +var _lgr = _utils.get_logger() + var return_val = null var stub_target = null var target_subpath = null @@ -29,20 +32,31 @@ func _init(target=null, method=null, subpath=null): stub_method = method target_subpath = subpath + func to_return(val): - return_val = val - call_super = false - _parameter_override_only = false + if(stub_method == '_init'): + _lgr.error("You cannot stub _init to do nothing. Super's _init is always called.") + else: + return_val = val + call_super = false + _parameter_override_only = false return self + func to_do_nothing(): - return to_return(null) + to_return(null) + return self + func to_call_super(): - call_super = true - _parameter_override_only = false + if(stub_method == '_init'): + _lgr.error("You cannot stub _init to call super. Super's _init is always called.") + else: + call_super = true + _parameter_override_only = false return self + func when_passed(p1=NOT_SET,p2=NOT_SET,p3=NOT_SET,p4=NOT_SET,p5=NOT_SET,p6=NOT_SET,p7=NOT_SET,p8=NOT_SET,p9=NOT_SET,p10=NOT_SET): parameters = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10] var idx = 0 @@ -53,24 +67,29 @@ func when_passed(p1=NOT_SET,p2=NOT_SET,p3=NOT_SET,p4=NOT_SET,p5=NOT_SET,p6=NOT_S idx += 1 return self + func param_count(x): parameter_count = x return self + func param_defaults(values): parameter_count = values.size() parameter_defaults = values return self + func has_param_override(): return parameter_count != -1 + func is_param_override_only(): var to_return = false if(has_param_override()): to_return = _parameter_override_only return to_return + func to_s(): var base_string = str(stub_target) if(target_subpath != null): |
