mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add more integration tests to the GDScript test suite
This also fixes a typo in the `bitwise_float_right_operand.gd` test.
This commit is contained in:
@@ -3,9 +3,16 @@
|
||||
@export_range(0, 100, 1) var example_range_step = 101
|
||||
@export_range(0, 100, 1, "or_greater") var example_range_step_or_greater = 102
|
||||
|
||||
@export var color: Color
|
||||
@export_color_no_alpha var color_no_alpha: Color
|
||||
@export_node_path(Sprite2D, Sprite3D, Control, Node) var nodepath := ^"hello"
|
||||
|
||||
|
||||
func test():
|
||||
print(example)
|
||||
print(example_range)
|
||||
print(example_range_step)
|
||||
print(example_range_step_or_greater)
|
||||
print(color)
|
||||
print(color_no_alpha)
|
||||
print(nodepath)
|
||||
|
||||
@@ -3,3 +3,6 @@ GDTEST_OK
|
||||
100
|
||||
101
|
||||
102
|
||||
(0, 0, 0, 1)
|
||||
(0, 0, 0, 1)
|
||||
hello
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
func example(_number: int, _number2: int = 5, number3 := 10):
|
||||
return number3
|
||||
|
||||
func test():
|
||||
print(example(3))
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
10
|
||||
@@ -0,0 +1,5 @@
|
||||
func example(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30, arg31, arg32, arg33, arg34, arg35, arg36, arg37, arg38, arg39, arg40, arg41, arg42, arg43, arg44, arg45, arg46, arg47, arg48 = false, arg49 = true, arg50 = null):
|
||||
print(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30, arg31, arg32, arg33, arg34, arg35, arg36, arg37, arg38, arg39, arg40, arg41, arg42, arg43, arg44, arg45, arg46, arg47, arg48, arg49, arg50)
|
||||
|
||||
func test():
|
||||
example(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47)
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
123456789101112131415161718192212223242526272829303132333435363738394041424344454647falsetruenull
|
||||
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var my_lambda = func(x):
|
||||
print(x)
|
||||
my_lambda.call("hello")
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
hello
|
||||
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var x = 42
|
||||
var my_lambda = func(): print(x)
|
||||
my_lambda.call() # Prints "42".
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
42
|
||||
@@ -0,0 +1,10 @@
|
||||
func i_take_lambda(lambda: Callable, param: String):
|
||||
lambda.call(param)
|
||||
|
||||
|
||||
func test():
|
||||
var my_lambda := func this_is_lambda(x):
|
||||
print("Hello")
|
||||
print("This is %s" % x)
|
||||
|
||||
i_take_lambda(my_lambda, "a lambda")
|
||||
@@ -0,0 +1,3 @@
|
||||
GDTEST_OK
|
||||
Hello
|
||||
This is a lambda
|
||||
@@ -0,0 +1,5 @@
|
||||
func foo(x):
|
||||
return x + 1
|
||||
|
||||
func test():
|
||||
print(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(0)))))))))))))))))))))))))
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
24
|
||||
@@ -0,0 +1,5 @@
|
||||
func test():
|
||||
var my_array: Array[int] = [1, 2, 3]
|
||||
var inferred_array := [1, 2, 3] # This is Array[int].
|
||||
print(my_array)
|
||||
print(inferred_array)
|
||||
@@ -0,0 +1,3 @@
|
||||
GDTEST_OK
|
||||
[1, 2, 3]
|
||||
[1, 2, 3]
|
||||
Reference in New Issue
Block a user