summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd20
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out2
2 files changed, 22 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd
new file mode 100644
index 0000000000..03278e453f
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd
@@ -0,0 +1,20 @@
+extends Node
+
+@onready var later_inferred := [1]
+@onready var later_static : Array
+@onready var later_static_with_init : Array = [1]
+@onready var later_untyped = [1]
+
+func test():
+ assert(typeof(later_inferred) == TYPE_ARRAY)
+ assert(later_inferred.size() == 0)
+
+ assert(typeof(later_static) == TYPE_ARRAY)
+ assert(later_static.size() == 0)
+
+ assert(typeof(later_static_with_init) == TYPE_ARRAY)
+ assert(later_static_with_init.size() == 0)
+
+ assert(typeof(later_untyped) == TYPE_NIL)
+
+ print("ok")
diff --git a/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok