1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

Add dozens of new integration tests to the GDScript test suite

This also ignores `.out` files in the file format static checks.
This commit is contained in:
Hugo Locurcio
2021-04-19 20:50:52 +02:00
parent a9b600bac0
commit c0083c0f90
190 changed files with 1788 additions and 17 deletions

View File

@@ -0,0 +1,3 @@
func test():
# Arrays with consecutive commas are not allowed.
var array = ["arrays",,,,]

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected expression as array element.

View File

@@ -0,0 +1,2 @@
func test():
var hello == "world"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected end of statement after variable declaration, found "==" instead.

View File

@@ -0,0 +1,2 @@
func test():
var hello === "world"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected end of statement after variable declaration, found "==" instead.

View File

@@ -0,0 +1,4 @@
func test():
# Error here.
if foo = 25:
print(foo)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Assignment is not allowed inside an expression.

View File

@@ -0,0 +1,2 @@
func test():
var hello = "world" = "test"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Assignment is not allowed inside an expression.

View File

@@ -0,0 +1,4 @@
func test():
# Error here.
if var foo = 25:
print(foo)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected conditional expression after "if".

View File

@@ -0,0 +1,2 @@
func test():
var = "world"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -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

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
"class_name" should be used before annotations.

View File

@@ -0,0 +1,3 @@
func test():
var TEST = 50
const TEST = 25

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
There is already a variable named "TEST" declared in this scope.

View File

@@ -0,0 +1,7 @@
func hello(arg1):
print(arg1)
func test():
# Error here.
hello(arg1 = 25)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Assignment is not allowed inside an expression.

View File

@@ -0,0 +1,5 @@
const test = 25
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Function "test" has the same name as a previously declared constant.

View File

@@ -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

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Variable "test" has the same name as a previously declared function.

View File

@@ -0,0 +1,3 @@
func test():
# Error here.
var 23test = "is not a valid identifier"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -0,0 +1,3 @@
func test():
# Error here.
var "yes" = "is not a valid identifier"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -1,6 +0,0 @@
func args(a, b):
print(a)
print(b)
func test():
args(1,)

View File

@@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
Too few arguments for "args()" call. Expected at least 2 but received 1.

View File

@@ -1,2 +1,2 @@
func test():
var a = ("missing paren ->"
var a = ("missing paren ->"

View File

@@ -1,3 +1,3 @@
func test():
if true # Missing colon here.
print("true")
if true # Missing colon here.
print("true")

View File

@@ -1,6 +1,6 @@
func args(a, b):
print(a)
print(b)
print(a)
print(b)
func test():
args(1,2
args(1,2

View File

@@ -0,0 +1,3 @@
func test():
# Number separators may not be placed right next to each other.
var __ = 1__23

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Only one underscore can be used as a numeric separator.

View File

@@ -1,3 +1,5 @@
extends Node
func test():
var a = $ # Expected some node path.
var a = $ # Expected some node path.

View File

@@ -0,0 +1,2 @@
func test():
var while = "it's been a while"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -0,0 +1,5 @@
func test():
const TEST = 25
# Error here (can't redeclare a constant on the same scope).
const TEST = 50

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
There is already a constant named "TEST" declared in this scope.

View File

@@ -0,0 +1,3 @@
func test():
const TEST = 25
var TEST = 50

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
There is already a constant named "TEST" declared in this scope.

View File

@@ -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

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Function "test" has the same name as a previously declared variable.

View File

@@ -1,3 +1,5 @@
extends Node
func test():
$23 # Can't use number here.
$23 # Can't use number here.

View File

@@ -1,3 +1,5 @@
extends Node
func test():
$MyNode/23 # Can't use number here.
$MyNode/23 # Can't use number here.