diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-26 15:59:27 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-26 15:59:27 +0100 |
commit | c118790eb9b445f7f0501a90473c60062502d8d9 (patch) | |
tree | cb302d5926a91fcd6881e5f13ce90678a619bfd5 /modules/gdscript/tests | |
parent | c6443e9a4e2aa1a788e3ccb6e4b3bdaed21f90a0 (diff) | |
parent | 0e6aa6fc3879c4c1c37bc598a83a44cb5cddfe85 (diff) |
Merge pull request #73899 from vnen/gdscript-init-defaults-beforehand
GDScript: Initialize all defaults beforehand in implicit constructor
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd | 20 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out | 2 |
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 |