1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

GDScript: Support tracking multiple analyzer and runtime errors in tests

This commit is contained in:
Danil Alexeev
2024-11-21 21:45:56 +03:00
parent 9e6098432a
commit f86dcd4e67
294 changed files with 540 additions and 1084 deletions

View File

@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
"@export_enum" annotation requires a variable of type "int", "Array[int]", "PackedByteArray", "PackedInt32Array", "PackedInt64Array", "String", "Array[String]", or "PackedStringArray", but type "Array[Color]" was given instead.
>> ERROR at line 1: "@export_enum" annotation requires a variable of type "int", "Array[int]", "PackedByteArray", "PackedInt32Array", "PackedInt64Array", "String", "Array[String]", or "PackedStringArray", but type "Array[Color]" was given instead.

View File

@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
"@export_enum" annotation requires a variable of type "int", "Array[int]", "PackedByteArray", "PackedInt32Array", "PackedInt64Array", "String", "Array[String]", or "PackedStringArray", but type "Color" was given instead.
>> ERROR at line 1: "@export_enum" annotation requires a variable of type "int", "Array[int]", "PackedByteArray", "PackedInt32Array", "PackedInt64Array", "String", "Array[String]", or "PackedStringArray", but type "Color" was given instead.

View File

@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
Tool buttons can only be used in tool scripts (add "@tool" to the top of the script).
>> ERROR at line 1: Tool buttons can only be used in tool scripts (add "@tool" to the top of the script).

View File

@@ -1,6 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 9
>> UNUSED_VARIABLE
>> The local variable "value" is declared but never used in the block. If this is intended, prefix it with an underscore: "_value".
~~ WARNING at line 9: (UNUSED_VARIABLE) The local variable "value" is declared but never used in the block. If this is intended, prefix it with an underscore: "_value".
value

View File

@@ -1,72 +1,21 @@
GDTEST_OK
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
~~ WARNING at line 19: (INTEGER_DIVISION) Integer division, decimal part will be discarded.
2.718
2.718

View File

@@ -1,13 +1,4 @@
GDTEST_OK
>> WARNING
>> Line: 3
>> ASSERT_ALWAYS_TRUE
>> Assert statement is redundant because the expression is always true.
>> WARNING
>> Line: 4
>> ASSERT_ALWAYS_TRUE
>> Assert statement is redundant because the expression is always true.
>> WARNING
>> Line: 5
>> ASSERT_ALWAYS_TRUE
>> Assert statement is redundant because the expression is always true.
~~ WARNING at line 3: (ASSERT_ALWAYS_TRUE) Assert statement is redundant because the expression is always true.
~~ WARNING at line 4: (ASSERT_ALWAYS_TRUE) Assert statement is redundant because the expression is always true.
~~ WARNING at line 5: (ASSERT_ALWAYS_TRUE) Assert statement is redundant because the expression is always true.

View File

@@ -1,10 +1,4 @@
GDTEST_OK
>> WARNING
>> Line: 5
>> CONFUSABLE_IDENTIFIER
>> The identifier "pοrt" has misleading characters and might be confused with something else.
>> WARNING
>> Line: 12
>> CONFUSABLE_IDENTIFIER
>> The identifier "pοrt" has misleading characters and might be confused with something else.
~~ WARNING at line 5: (CONFUSABLE_IDENTIFIER) The identifier "pοrt" has misleading characters and might be confused with something else.
~~ WARNING at line 12: (CONFUSABLE_IDENTIFIER) The identifier "pοrt" has misleading characters and might be confused with something else.
0 1

View File

@@ -0,0 +1,2 @@
GDTEST_OK
~~ WARNING at line 1: (EMPTY_FILE) Empty script file.

View File

@@ -1,4 +0,0 @@
>> WARNING
>> Line: 1
>> EMPTY_FILE
>> Empty script file.

View File

@@ -0,0 +1 @@
# A comment.

View File

@@ -0,0 +1,2 @@
GDTEST_OK
~~ WARNING at line 1: (EMPTY_FILE) Empty script file.

View File

@@ -1,4 +0,0 @@
>> WARNING
>> Line: 1
>> EMPTY_FILE
>> Empty script file.

View File

@@ -0,0 +1,2 @@
GDTEST_OK
~~ WARNING at line 1: (EMPTY_FILE) Empty script file.

View File

@@ -1,4 +0,0 @@
>> WARNING
>> Line: 1
>> EMPTY_FILE
>> Empty script file.

View File

@@ -0,0 +1,4 @@
# A comment, followed by a bunch of newlines.

View File

@@ -0,0 +1,2 @@
GDTEST_OK
~~ WARNING at line 1: (EMPTY_FILE) Empty script file.

View File

@@ -1,4 +0,0 @@
#a comment, followed by a bunch of newlines

View File

@@ -1,4 +0,0 @@
>> WARNING
>> Line: 1
>> EMPTY_FILE
>> Empty script file.

View File

@@ -1,20 +1,8 @@
GDTEST_OK
>> WARNING
>> Line: 5
>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
>> WARNING
>> Line: 9
>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
>> WARNING
>> Line: 12
>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
>> WARNING
>> Line: 14
>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
~~ WARNING at line 5: (INT_AS_ENUM_WITHOUT_CAST) Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
~~ WARNING at line 9: (INT_AS_ENUM_WITHOUT_CAST) Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
~~ WARNING at line 12: (INT_AS_ENUM_WITHOUT_CAST) Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
~~ WARNING at line 14: (INT_AS_ENUM_WITHOUT_CAST) Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
0
1
0

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 8
>> INCOMPATIBLE_TERNARY
>> Values of the ternary operator are not mutually compatible.
~~ WARNING at line 8: (INCOMPATIBLE_TERNARY) Values of the ternary operator are not mutually compatible.

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 3
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
~~ WARNING at line 3: (INTEGER_DIVISION) Integer division, decimal part will be discarded.

View File

@@ -1,6 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 8
>> UNREACHABLE_PATTERN
>> Unreachable pattern (pattern after wildcard or bind).
~~ WARNING at line 8: (UNREACHABLE_PATTERN) Unreachable pattern (pattern after wildcard or bind).
default

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 5
>> NARROWING_CONVERSION
>> Narrowing conversion (float is converted to int and loses precision).
~~ WARNING at line 5: (NARROWING_CONVERSION) Narrowing conversion (float is converted to int and loses precision).

View File

@@ -1,9 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 6
>> RETURN_VALUE_DISCARDED
>> The function "i_return_int()" returns a value that will be discarded if not used.
>> WARNING
>> Line: 7
>> RETURN_VALUE_DISCARDED
>> The function "preload()" returns a value that will be discarded if not used.
~~ WARNING at line 6: (RETURN_VALUE_DISCARDED) The function "i_return_int()" returns a value that will be discarded if not used.
~~ WARNING at line 7: (RETURN_VALUE_DISCARDED) The function "preload()" returns a value that will be discarded if not used.

View File

@@ -1,9 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 8
>> UNUSED_LOCAL_CONSTANT
>> The local constant "TEST" is declared but never used in the block. If this is intended, prefix it with an underscore: "_TEST".
>> WARNING
>> Line: 8
>> SHADOWED_VARIABLE
>> The local constant "TEST" is shadowing an already-declared constant at line 2 in the current class.
~~ WARNING at line 8: (UNUSED_LOCAL_CONSTANT) The local constant "TEST" is declared but never used in the block. If this is intended, prefix it with an underscore: "_TEST".
~~ WARNING at line 8: (SHADOWED_VARIABLE) The local constant "TEST" is shadowing an already-declared constant at line 2 in the current class.

View File

@@ -1,9 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_VARIABLE
>> The local variable "abs" is declared but never used in the block. If this is intended, prefix it with an underscore: "_abs".
>> WARNING
>> Line: 2
>> SHADOWED_GLOBAL_IDENTIFIER
>> The variable "abs" has the same name as a built-in function.
~~ WARNING at line 2: (UNUSED_VARIABLE) The local variable "abs" is declared but never used in the block. If this is intended, prefix it with an underscore: "_abs".
~~ WARNING at line 2: (SHADOWED_GLOBAL_IDENTIFIER) The variable "abs" has the same name as a built-in function.

View File

@@ -1,9 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 8
>> UNUSED_VARIABLE
>> The local variable "foo" is declared but never used in the block. If this is intended, prefix it with an underscore: "_foo".
>> WARNING
>> Line: 8
>> SHADOWED_VARIABLE
>> The local variable "foo" is shadowing an already-declared variable at line 1 in the current class.
~~ WARNING at line 8: (UNUSED_VARIABLE) The local variable "foo" is declared but never used in the block. If this is intended, prefix it with an underscore: "_foo".
~~ WARNING at line 8: (SHADOWED_VARIABLE) The local variable "foo" is shadowing an already-declared variable at line 1 in the current class.

View File

@@ -1,9 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_VARIABLE
>> The local variable "test" is declared but never used in the block. If this is intended, prefix it with an underscore: "_test".
>> WARNING
>> Line: 2
>> SHADOWED_VARIABLE
>> The local variable "test" is shadowing an already-declared function at line 1 in the current class.
~~ WARNING at line 2: (UNUSED_VARIABLE) The local variable "test" is declared but never used in the block. If this is intended, prefix it with an underscore: "_test".
~~ WARNING at line 2: (SHADOWED_VARIABLE) The local variable "test" is shadowing an already-declared function at line 1 in the current class.

View File

@@ -1,17 +1,5 @@
GDTEST_OK
>> WARNING
>> Line: 3
>> STANDALONE_EXPRESSION
>> Standalone expression (the line may have no effect).
>> WARNING
>> Line: 4
>> STANDALONE_EXPRESSION
>> Standalone expression (the line may have no effect).
>> WARNING
>> Line: 6
>> STANDALONE_EXPRESSION
>> Standalone expression (the line may have no effect).
>> WARNING
>> Line: 7
>> STANDALONE_EXPRESSION
>> Standalone expression (the line may have no effect).
~~ WARNING at line 3: (STANDALONE_EXPRESSION) Standalone expression (the line may have no effect).
~~ WARNING at line 4: (STANDALONE_EXPRESSION) Standalone expression (the line may have no effect).
~~ WARNING at line 6: (STANDALONE_EXPRESSION) Standalone expression (the line may have no effect).
~~ WARNING at line 7: (STANDALONE_EXPRESSION) Standalone expression (the line may have no effect).

View File

@@ -1,10 +1,4 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> STANDALONE_TERNARY
>> Standalone ternary operator: the return value is being discarded.
>> WARNING
>> Line: 3
>> STANDALONE_TERNARY
>> Standalone ternary operator: the return value is being discarded.
~~ WARNING at line 2: (STANDALONE_TERNARY) Standalone ternary operator: the return value is being discarded.
~~ WARNING at line 3: (STANDALONE_TERNARY) Standalone ternary operator: the return value is being discarded.
1

View File

@@ -1,15 +1,6 @@
GDTEST_OK
>> WARNING
>> Line: 13
>> STATIC_CALLED_ON_INSTANCE
>> The function "num_uint64()" is a static function but was called from an instance. Instead, it should be directly called from the type: "String.num_uint64()".
>> WARNING
>> Line: 19
>> STATIC_CALLED_ON_INSTANCE
>> The function "static_func()" is a static function but was called from an instance. Instead, it should be directly called from the type: "TestStaticCalledOnInstance.static_func()".
>> WARNING
>> Line: 23
>> STATIC_CALLED_ON_INSTANCE
>> The function "static_func()" is a static function but was called from an instance. Instead, it should be directly called from the type: "Inner.static_func()".
~~ WARNING at line 13: (STATIC_CALLED_ON_INSTANCE) The function "num_uint64()" is a static function but was called from an instance. Instead, it should be directly called from the type: "String.num_uint64()".
~~ WARNING at line 19: (STATIC_CALLED_ON_INSTANCE) The function "static_func()" is a static function but was called from an instance. Instead, it should be directly called from the type: "TestStaticCalledOnInstance.static_func()".
~~ WARNING at line 23: (STATIC_CALLED_ON_INSTANCE) The function "static_func()" is a static function but was called from an instance. Instead, it should be directly called from the type: "Inner.static_func()".
8589934592
8589934592

View File

@@ -1,16 +1,7 @@
GDTEST_OK
>> WARNING
>> Line: 3
>> UNASSIGNED_VARIABLE
>> The variable "unassigned" was used before being assigned a value.
>> WARNING
>> Line: 7
>> UNASSIGNED_VARIABLE
>> The variable "a" was used before being assigned a value.
>> WARNING
>> Line: 8
>> UNASSIGNED_VARIABLE
>> The variable "a" was used before being assigned a value.
~~ WARNING at line 3: (UNASSIGNED_VARIABLE) The variable "unassigned" was used before being assigned a value.
~~ WARNING at line 7: (UNASSIGNED_VARIABLE) The variable "a" was used before being assigned a value.
~~ WARNING at line 8: (UNASSIGNED_VARIABLE) The variable "a" was used before being assigned a value.
<null>
<null>
<null>

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 4
>> UNASSIGNED_VARIABLE_OP_ASSIGN
>> Using assignment with operation but the variable "__" was not previously assigned a value.
~~ WARNING at line 4: (UNASSIGNED_VARIABLE_OP_ASSIGN) Using assignment with operation but the variable "__" was not previously assigned a value.

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 7
>> UNREACHABLE_CODE
>> Unreachable code (statement after return) in function "test()".
~~ WARNING at line 7: (UNREACHABLE_CODE) Unreachable code (statement after return) in function "test()".

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_PARAMETER
>> The parameter "p_arg2" is never used in the function "function_with_unused_argument()". If this is intended, prefix it with an underscore: "_p_arg2".
~~ WARNING at line 2: (UNUSED_PARAMETER) The parameter "p_arg2" is never used in the function "function_with_unused_argument()". If this is intended, prefix it with an underscore: "_p_arg2".

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_LOCAL_CONSTANT
>> The local constant "UNUSED" is declared but never used in the block. If this is intended, prefix it with an underscore: "_UNUSED".
~~ WARNING at line 2: (UNUSED_LOCAL_CONSTANT) The local constant "UNUSED" is declared but never used in the block. If this is intended, prefix it with an underscore: "_UNUSED".

View File

@@ -1,5 +1,2 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_VARIABLE
>> The local variable "unused" is declared but never used in the block. If this is intended, prefix it with an underscore: "_unused".
~~ WARNING at line 2: (UNUSED_VARIABLE) The local variable "unused" is declared but never used in the block. If this is intended, prefix it with an underscore: "_unused".