-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48029 from Calinou/gdscript-add-integration-tests
Add dozens of new integration tests to the GDScript test suite
- Loading branch information
Showing
190 changed files
with
1,788 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/analyzer/errors/bitwise_float_left_operand.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Error here. | ||
print(2.2 << 4) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/bitwise_float_left_operand.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid operands to operator <<, float and int. |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/analyzer/errors/bitwise_float_right_operand.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Error here. | ||
print(2 << 4.4) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/bitwise_float_right_operand.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid operands to operator <<, int and float. |
5 changes: 5 additions & 0 deletions
5
modules/gdscript/tests/scripts/analyzer/errors/constant_used_as_function.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const CONSTANT = 25 | ||
|
||
|
||
func test(): | ||
CONSTANT(123) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/constant_used_as_function.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Member "CONSTANT" is not a function. |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/analyzer/errors/enum_float_value.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
enum Size { | ||
# Error here. Enum values must be integers. | ||
S = 0.0, | ||
} | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/enum_float_value.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Enum values must be integers. |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/analyzer/errors/enum_string_value.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
enum Size { | ||
# Error here. Enum values must be integers. | ||
S = "hello", | ||
} | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/enum_string_value.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Enum values must be integers. |
6 changes: 6 additions & 0 deletions
6
modules/gdscript/tests/scripts/analyzer/errors/function_used_as_property.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
func function(): | ||
pass | ||
|
||
|
||
func test(): | ||
function = 25 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/function_used_as_property.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot assign a new value to a constant. |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Error here. Array indices must be integers. | ||
print([0, 1][true]) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid index type "bool" for a base of type "Array". |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_concatenation_bool.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
print(true + true) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_concatenation_bool.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid operands to operator +, bool and bool. |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_concatenation_dictionary.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
print({"hello": "world"} + {"godot": "engine"}) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_concatenation_dictionary.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid operands "Dictionary" and "Dictionary" for "+" operator. |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_concatenation_mixed.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
print("hello" + ["world"]) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_concatenation_mixed.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid operands "String" and "Array" for "+" operator. |
5 changes: 5 additions & 0 deletions
5
modules/gdscript/tests/scripts/analyzer/errors/invalid_constant.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
func test(): | ||
var i = 12 | ||
# Constants must be made of a constant, deterministic expression. | ||
# A constant that depends on a variable's value is not a constant expression. | ||
const TEST = 13 + i |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/invalid_constant.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Assigned value for constant "TEST" isn't a constant expression. |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/analyzer/errors/leading_number_separator.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Number separators may not be placed at the beginning of a number. | ||
var __ = _123 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/leading_number_separator.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Identifier "_123" not declared in the current scope. |
6 changes: 6 additions & 0 deletions
6
modules/gdscript/tests/scripts/analyzer/errors/missing_argument.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
func args(a, b): | ||
print(a) | ||
print(b) | ||
|
||
func test(): | ||
args(1,) |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
modules/gdscript/tests/scripts/analyzer/errors/property_used_as_function.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var property = 25 | ||
|
||
func test(): | ||
property() |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/property_used_as_function.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Member "property" is not a function. |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/analyzer/errors/redefine_class_constant.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# See also `parser-warnings/shadowed-constant.gd`. | ||
const TEST = 25 | ||
|
||
|
||
func test(): | ||
# Error here (trying to set a new value to a constant). | ||
TEST = 50 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/redefine_class_constant.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot assign a new value to a constant. |
5 changes: 5 additions & 0 deletions
5
modules/gdscript/tests/scripts/analyzer/errors/redefine_local_constant.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
func test(): | ||
const TEST = 25 | ||
|
||
# Error here (can't assign a new value to a constant). | ||
TEST = 50 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/redefine_local_constant.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot assign a new value to a constant. |
11 changes: 11 additions & 0 deletions
11
modules/gdscript/tests/scripts/analyzer/errors/super_nonexistent_base_method.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `class` extends RefCounted by default. | ||
class Say: | ||
func say(): | ||
super() | ||
print("say something") | ||
|
||
|
||
func test(): | ||
# RefCounted doesn't have a `say()` method, so the `super()` call in the method | ||
# definition will cause a run-time error. | ||
Say.new().say() |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/super_nonexistent_base_method.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Function "say()" not found in base RefCounted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
func test(): | ||
var some_bool = 5 as bool | ||
var some_int = 5 as int | ||
var some_float = 5 as float | ||
print(typeof(some_bool)) | ||
print(typeof(some_int)) | ||
print(typeof(some_float)) | ||
|
||
print() | ||
|
||
var some_bool_typed := 5 as bool | ||
var some_int_typed := 5 as int | ||
var some_float_typed := 5 as float | ||
print(typeof(some_bool_typed)) | ||
print(typeof(some_int_typed)) | ||
print(typeof(some_float_typed)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
GDTEST_OK | ||
1 | ||
2 | ||
3 | ||
|
||
1 | ||
2 | ||
3 |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/parser/errors/array_consecutive_commas.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Arrays with consecutive commas are not allowed. | ||
var array = ["arrays",,,,] |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/array_consecutive_commas.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected expression as array element. |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_2_equal_signs.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
var hello == "world" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_2_equal_signs.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected end of statement after variable declaration, found "==" instead. |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_3_equal_signs.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
var hello === "world" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_3_equal_signs.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected end of statement after variable declaration, found "==" instead. |
4 changes: 4 additions & 0 deletions
4
modules/gdscript/tests/scripts/parser/errors/assignment_in_if.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
func test(): | ||
# Error here. | ||
if foo = 25: | ||
print(foo) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_in_if.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Assignment is not allowed inside an expression. |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_in_var.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
var hello = "world" = "test" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_in_var.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Assignment is not allowed inside an expression. |
4 changes: 4 additions & 0 deletions
4
modules/gdscript/tests/scripts/parser/errors/assignment_in_var_if.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
func test(): | ||
# Error here. | ||
if var foo = 25: | ||
print(foo) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_in_var_if.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected conditional expression after "if". |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_without_identifier.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
var = "world" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/assignment_without_identifier.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected variable name after "var". |
6 changes: 6 additions & 0 deletions
6
modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Error here. `class_name` should be used *before* annotations, not after. | ||
@icon("res://path/to/optional/icon.svg") | ||
class_name HelloWorld | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
"class_name" should be used before annotations. |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/parser/errors/constant_conflicts_variable.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
var TEST = 50 | ||
const TEST = 25 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/constant_conflicts_variable.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
There is already a variable named "TEST" declared in this scope. |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/parser/errors/default_value_in_function_call.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
func hello(arg1): | ||
print(arg1) | ||
|
||
|
||
func test(): | ||
# Error here. | ||
hello(arg1 = 25) |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/default_value_in_function_call.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Assignment is not allowed inside an expression. |
5 changes: 5 additions & 0 deletions
5
modules/gdscript/tests/scripts/parser/errors/function_conflicts_constant.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const test = 25 | ||
|
||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/function_conflicts_constant.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Function "test" has the same name as a previously declared constant. |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/parser/errors/function_conflicts_variable.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
func test(): | ||
pass | ||
|
||
|
||
# Error here. The difference with `variable-conflicts-function.gd` is that here, | ||
# the function is defined *before* the variable. | ||
var test = 25 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/function_conflicts_variable.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Variable "test" has the same name as a previously declared function. |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/parser/errors/invalid_identifier_number.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Error here. | ||
var 23test = "is not a valid identifier" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/invalid_identifier_number.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected variable name after "var". |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/parser/errors/invalid_identifier_string.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Error here. | ||
var "yes" = "is not a valid identifier" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/invalid_identifier_string.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected variable name after "var". |
6 changes: 0 additions & 6 deletions
6
modules/gdscript/tests/scripts/parser/errors/missing_argument.gd
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
modules/gdscript/tests/scripts/parser/errors/missing_closing_expr_paren.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
func test(): | ||
var a = ("missing paren ->" | ||
var a = ("missing paren ->" |
4 changes: 2 additions & 2 deletions
4
modules/gdscript/tests/scripts/parser/errors/missing_colon.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
func test(): | ||
if true # Missing colon here. | ||
print("true") | ||
if true # Missing colon here. | ||
print("true") |
6 changes: 3 additions & 3 deletions
6
modules/gdscript/tests/scripts/parser/errors/missing_paren_after_args.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
func args(a, b): | ||
print(a) | ||
print(b) | ||
print(a) | ||
print(b) | ||
|
||
func test(): | ||
args(1,2 | ||
args(1,2 |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/parser/errors/multiple_number_separators.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
# Number separators may not be placed right next to each other. | ||
var __ = 1__23 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/multiple_number_separators.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Only one underscore can be used as a numeric separator. |
4 changes: 3 additions & 1 deletion
4
modules/gdscript/tests/scripts/parser/errors/nothing_after_dollar.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
extends Node | ||
|
||
|
||
func test(): | ||
var a = $ # Expected some node path. | ||
var a = $ # Expected some node path. |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/redefine_keyword.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
func test(): | ||
var while = "it's been a while" |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/redefine_keyword.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Expected variable name after "var". |
5 changes: 5 additions & 0 deletions
5
modules/gdscript/tests/scripts/parser/errors/redefine_local_constant_with_keyword.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
func test(): | ||
const TEST = 25 | ||
|
||
# Error here (can't redeclare a constant on the same scope). | ||
const TEST = 50 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/redefine_local_constant_with_keyword.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
There is already a constant named "TEST" declared in this scope. |
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/parser/errors/variable_conflicts_constant.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func test(): | ||
const TEST = 25 | ||
var TEST = 50 |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/variable_conflicts_constant.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
There is already a constant named "TEST" declared in this scope. |
6 changes: 6 additions & 0 deletions
6
modules/gdscript/tests/scripts/parser/errors/variable_conflicts_function.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var test = 25 | ||
|
||
# Error here. The difference with `variable-conflicts-function.gd` is that here, | ||
# the function is defined *before* the variable. | ||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/parser/errors/variable_conflicts_function.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_PARSER_ERROR | ||
Function "test" has the same name as a previously declared variable. |
4 changes: 3 additions & 1 deletion
4
modules/gdscript/tests/scripts/parser/errors/wrong_value_after_dollar.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
extends Node | ||
|
||
|
||
func test(): | ||
$23 # Can't use number here. | ||
$23 # Can't use number here. |
4 changes: 3 additions & 1 deletion
4
modules/gdscript/tests/scripts/parser/errors/wrong_value_after_dollar_slash.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
extends Node | ||
|
||
|
||
func test(): | ||
$MyNode/23 # Can't use number here. | ||
$MyNode/23 # Can't use number here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
func test(): | ||
# Indexing from the beginning: | ||
print([1, 2, 3][0]) | ||
print([1, 2, 3][1]) | ||
print([1, 2, 3][2]) | ||
|
||
# Indexing from the end: | ||
print([1, 2, 3][-1]) | ||
print([1, 2, 3][-2]) | ||
print([1, 2, 3][-3]) | ||
|
||
# Float indices are currently allowed, but should probably be an error? | ||
print([1, 2, 3][0.4]) | ||
print([1, 2, 3][0.8]) | ||
print([1, 2, 3][1.0]) | ||
print([1, 2, 3][-1.0]) |
Oops, something went wrong.