diff options
Diffstat (limited to 'modules/gdscript/tests')
9 files changed, 29 insertions, 3 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/gd_utility_function_wrong_arg.gd b/modules/gdscript/tests/scripts/analyzer/errors/gd_utility_function_wrong_arg.gd new file mode 100644 index 0000000000..c06fbd89ff --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/gd_utility_function_wrong_arg.gd @@ -0,0 +1,2 @@ +func test(): + print(len(Color())) # GDScript utility function. diff --git a/modules/gdscript/tests/scripts/analyzer/errors/gd_utility_function_wrong_arg.out b/modules/gdscript/tests/scripts/analyzer/errors/gd_utility_function_wrong_arg.out new file mode 100644 index 0000000000..9cb04f6240 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/gd_utility_function_wrong_arg.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Invalid argument for "len()" function: Value of type 'Color' can't provide a length. diff --git a/modules/gdscript/tests/scripts/analyzer/errors/utility_function_wrong_arg.gd b/modules/gdscript/tests/scripts/analyzer/errors/utility_function_wrong_arg.gd new file mode 100644 index 0000000000..dc6e26e682 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/utility_function_wrong_arg.gd @@ -0,0 +1,2 @@ +func test(): + print(floor(Color())) # Built-in utility function. diff --git a/modules/gdscript/tests/scripts/analyzer/errors/utility_function_wrong_arg.out b/modules/gdscript/tests/scripts/analyzer/errors/utility_function_wrong_arg.out new file mode 100644 index 0000000000..27d2504dd0 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/utility_function_wrong_arg.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Invalid argument for "floor()" function: Argument "x" must be "int", "float", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", or "Vector4i". diff --git a/modules/gdscript/tests/scripts/runtime/errors/gd_utility_function_wrong_arg.gd b/modules/gdscript/tests/scripts/runtime/errors/gd_utility_function_wrong_arg.gd new file mode 100644 index 0000000000..340fc8c150 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/errors/gd_utility_function_wrong_arg.gd @@ -0,0 +1,3 @@ +func test(): + var x = Color() + print(len(x)) # GDScript utility function. diff --git a/modules/gdscript/tests/scripts/runtime/errors/gd_utility_function_wrong_arg.out b/modules/gdscript/tests/scripts/runtime/errors/gd_utility_function_wrong_arg.out new file mode 100644 index 0000000000..6d2938dcf3 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/errors/gd_utility_function_wrong_arg.out @@ -0,0 +1,6 @@ +GDTEST_RUNTIME_ERROR +>> SCRIPT ERROR +>> on function: test() +>> runtime/errors/gd_utility_function_wrong_arg.gd +>> 3 +>> Error calling GDScript utility function "len()": Value of type 'Color' can't provide a length. diff --git a/modules/gdscript/tests/scripts/runtime/errors/utility_function_wrong_arg.gd b/modules/gdscript/tests/scripts/runtime/errors/utility_function_wrong_arg.gd new file mode 100644 index 0000000000..6568155bae --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/errors/utility_function_wrong_arg.gd @@ -0,0 +1,3 @@ +func test(): + var x = Color() + print(floor(x)) # Built-in utility function. diff --git a/modules/gdscript/tests/scripts/runtime/errors/utility_function_wrong_arg.out b/modules/gdscript/tests/scripts/runtime/errors/utility_function_wrong_arg.out new file mode 100644 index 0000000000..b311bfa38a --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/errors/utility_function_wrong_arg.out @@ -0,0 +1,6 @@ +GDTEST_RUNTIME_ERROR +>> SCRIPT ERROR +>> on function: test() +>> runtime/errors/utility_function_wrong_arg.gd +>> 3 +>> Error calling utility function "floor()": Argument "x" must be "int", "float", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", or "Vector4i". diff --git a/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd b/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd index fd1460a48f..691b611574 100644 --- a/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd +++ b/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd @@ -7,7 +7,7 @@ func test(): test_builtin_call_validated(Vector2.UP, false) test_object_call(RefCounted.new(), false) test_object_call_method_bind(Resource.new(), false) - test_object_call_ptrcall(RefCounted.new(), false) + test_object_call_method_bind_validated(RefCounted.new(), false) print("end") @@ -40,7 +40,7 @@ func test_object_call_method_bind(v: Resource, f): v.duplicate() # Native type method call with MethodBind. assert(not f) # Test unary operator reading from `nil`. -func test_object_call_ptrcall(v: RefCounted, f): +func test_object_call_method_bind_validated(v: RefCounted, f): @warning_ignore("return_value_discarded") - v.get_reference_count() # Native type method call with ptrcall. + v.get_reference_count() # Native type method call with validated MethodBind. assert(not f) # Test unary operator reading from `nil`. |