diff options
author | Danil Alexeev <danil@alexeev.xyz> | 2023-06-30 20:40:02 +0300 |
---|---|---|
committer | Danil Alexeev <danil@alexeev.xyz> | 2023-10-16 14:09:57 +0300 |
commit | 0c2202c56e4c87c53dde17b35c8677974985ae81 (patch) | |
tree | fe7f07a9f165790d48493cbc5d922051c49c50c3 /modules/gdscript/tests/scripts | |
parent | a574c0296b38d5f786f249b12e6251e562c528cc (diff) | |
download | redot-engine-0c2202c56e4c87c53dde17b35c8677974985ae81.tar.gz |
GDScript: Fix incorrect error message for utility functions
Diffstat (limited to 'modules/gdscript/tests/scripts')
8 files changed, 26 insertions, 0 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". |