summaryrefslogtreecommitdiff
path: root/addons/gut/test.gd
diff options
context:
space:
mode:
Diffstat (limited to 'addons/gut/test.gd')
-rw-r--r--addons/gut/test.gd42
1 files changed, 39 insertions, 3 deletions
diff --git a/addons/gut/test.gd b/addons/gut/test.gd
index 2a80a8d..3fc0e8f 100644
--- a/addons/gut/test.gd
+++ b/addons/gut/test.gd
@@ -793,13 +793,15 @@ func get_call_count(object, method_name, parameters=null):
return gut.get_spy().call_count(object, method_name, parameters)
# ------------------------------------------------------------------------------
-# Assert that object is an instance of a_class
+# Deprecated. Use assert_is.
# ------------------------------------------------------------------------------
func assert_extends(object, a_class, text=''):
_lgr.deprecated('assert_extends', 'assert_is')
assert_is(object, a_class, text)
-# Alias for assert_extends
+# ------------------------------------------------------------------------------
+# Assert that object is an instance of a_class
+# ------------------------------------------------------------------------------
func assert_is(object, a_class, text=''):
var disp = ''#var disp = str('Expected [', _str(object), '] to be type of [', a_class, ']: ', text)
var NATIVE_CLASS = 'GDScriptNativeClass'
@@ -1511,7 +1513,7 @@ func use_parameters(params):
ph = _utils.ParameterHandler.new(params)
gut.set_parameter_handler(ph)
- var output = str('(call #', ph.get_call_count() + 1, ') with paramters: ', ph.get_current_parameters())
+ var output = str('(call #', ph.get_call_count() + 1, ') with parameters: ', ph.get_current_parameters())
_lgr.log(output)
_lgr.inc_indent()
return ph.next_parameters()
@@ -1649,3 +1651,37 @@ func assert_ne_shallow(v1, v2):
_pass(result.get_short_summary())
else:
_fail(result.get_short_summary())
+
+
+# ------------------------------------------------------------------------------
+# Checks the passed in version string (x.x.x) against the engine version to see
+# if the engine version is less than the expected version. If it is then the
+# test is mareked as passed (for a lack of anything better to do). The result
+# of the check is returned.
+#
+# Example:
+# if(skip_if_godot_version_lt('3.5.0')):
+# return
+# ------------------------------------------------------------------------------
+func skip_if_godot_version_lt(expected):
+ var should_skip = !_utils.is_godot_version_gte(expected)
+ if(should_skip):
+ _pass(str('Skipping ', _utils.godot_version(), ' is less than ', expected))
+ return should_skip
+
+
+# ------------------------------------------------------------------------------
+# Checks if the passed in version matches the engine version. The passed in
+# version can contain just the major, major.minor or major.minor.path. If
+# the version is not the same then the test is marked as passed. The result of
+# the check is returned.
+#
+# Example:
+# if(skip_if_godot_version_ne('3.4')):
+# return
+# ------------------------------------------------------------------------------
+func skip_if_godot_version_ne(expected):
+ var should_skip = !_utils.is_godot_version(expected)
+ if(should_skip):
+ _pass(str('Skipping ', _utils.godot_version(), ' is not ', expected))
+ return should_skip \ No newline at end of file