You've already forked godot
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:
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
# Arrays with consecutive commas are not allowed.
|
||||
var array = ["arrays",,,,]
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected expression as array element.
|
||||
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
var hello == "world"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected end of statement after variable declaration, found "==" instead.
|
||||
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
var hello === "world"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected end of statement after variable declaration, found "==" instead.
|
||||
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
# Error here.
|
||||
if foo = 25:
|
||||
print(foo)
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Assignment is not allowed inside an expression.
|
||||
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
var hello = "world" = "test"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Assignment is not allowed inside an expression.
|
||||
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
# Error here.
|
||||
if var foo = 25:
|
||||
print(foo)
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected conditional expression after "if".
|
||||
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
var = "world"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected variable name after "var".
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
"class_name" should be used before annotations.
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
var TEST = 50
|
||||
const TEST = 25
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
There is already a variable named "TEST" declared in this scope.
|
||||
@@ -0,0 +1,7 @@
|
||||
func hello(arg1):
|
||||
print(arg1)
|
||||
|
||||
|
||||
func test():
|
||||
# Error here.
|
||||
hello(arg1 = 25)
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Assignment is not allowed inside an expression.
|
||||
@@ -0,0 +1,5 @@
|
||||
const test = 25
|
||||
|
||||
|
||||
func test():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Function "test" has the same name as a previously declared constant.
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Variable "test" has the same name as a previously declared function.
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
# Error here.
|
||||
var 23test = "is not a valid identifier"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected variable name after "var".
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
# Error here.
|
||||
var "yes" = "is not a valid identifier"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected variable name after "var".
|
||||
@@ -1,6 +0,0 @@
|
||||
func args(a, b):
|
||||
print(a)
|
||||
print(b)
|
||||
|
||||
func test():
|
||||
args(1,)
|
||||
@@ -1,2 +0,0 @@
|
||||
GDTEST_ANALYZER_ERROR
|
||||
Too few arguments for "args()" call. Expected at least 2 but received 1.
|
||||
@@ -1,2 +1,2 @@
|
||||
func test():
|
||||
var a = ("missing paren ->"
|
||||
var a = ("missing paren ->"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
func test():
|
||||
if true # Missing colon here.
|
||||
print("true")
|
||||
if true # Missing colon here.
|
||||
print("true")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
func args(a, b):
|
||||
print(a)
|
||||
print(b)
|
||||
print(a)
|
||||
print(b)
|
||||
|
||||
func test():
|
||||
args(1,2
|
||||
args(1,2
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
# Number separators may not be placed right next to each other.
|
||||
var __ = 1__23
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Only one underscore can be used as a numeric separator.
|
||||
@@ -1,3 +1,5 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func test():
|
||||
var a = $ # Expected some node path.
|
||||
var a = $ # Expected some node path.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
var while = "it's been a while"
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Expected variable name after "var".
|
||||
@@ -0,0 +1,5 @@
|
||||
func test():
|
||||
const TEST = 25
|
||||
|
||||
# Error here (can't redeclare a constant on the same scope).
|
||||
const TEST = 50
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
There is already a constant named "TEST" declared in this scope.
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
const TEST = 25
|
||||
var TEST = 50
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
There is already a constant named "TEST" declared in this scope.
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Function "test" has the same name as a previously declared variable.
|
||||
@@ -1,3 +1,5 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func test():
|
||||
$23 # Can't use number here.
|
||||
$23 # Can't use number here.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func test():
|
||||
$MyNode/23 # Can't use number here.
|
||||
$MyNode/23 # Can't use number here.
|
||||
|
||||
Reference in New Issue
Block a user