summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/analyzer
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.gd2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.gd2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.gd2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.gd28
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.out25
8 files changed, 65 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.gd b/modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.gd
new file mode 100644
index 0000000000..6367d50980
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.gd
@@ -0,0 +1,2 @@
+func test():
+ print(Vector3.Axis)
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.out
new file mode 100644
index 0000000000..9c476031f3
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_builtin_access.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Type "Axis" in base "Vector3" cannot be used on its own.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.gd b/modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.gd
new file mode 100644
index 0000000000..badcd3a83c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.gd
@@ -0,0 +1,2 @@
+func test():
+ print(Variant.Operator)
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.out
new file mode 100644
index 0000000000..191acade73
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_global_access.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Type "Operator" in base "Variant" cannot be used on its own.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.gd b/modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.gd
new file mode 100644
index 0000000000..e07998ddf6
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.gd
@@ -0,0 +1,2 @@
+func test():
+ print(Node.ProcessMode)
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.out
new file mode 100644
index 0000000000..83671fc493
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_native_access.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Type "ProcessMode" in base "Node" cannot be used on its own.
diff --git a/modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.gd b/modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.gd
new file mode 100644
index 0000000000..4ccd7de994
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.gd
@@ -0,0 +1,28 @@
+extends Node
+
+@export var test_type_1 := TYPE_BOOL
+@export var test_type_2 := Variant.Type.TYPE_BOOL
+@export var test_type_3: Variant.Type
+
+@export var test_side_1 := SIDE_RIGHT
+@export var test_side_2 := Side.SIDE_RIGHT
+@export var test_side_3: Side
+
+@export var test_axis_1 := Vector3.AXIS_Y
+@export var test_axis_2 := Vector3.Axis.AXIS_Y
+@export var test_axis_3: Vector3.Axis
+
+@export var test_mode_1 := Node.PROCESS_MODE_ALWAYS
+@export var test_mode_2 := Node.ProcessMode.PROCESS_MODE_ALWAYS
+@export var test_mode_3: Node.ProcessMode
+
+func test():
+ for property in get_property_list():
+ if str(property.name).begins_with("test_"):
+ Utils.print_property_extended_info(property, self)
+
+func test_no_exec():
+ # GH-99309
+ var sprite: Sprite3D = $Sprite3D
+ sprite.axis = Vector3.AXIS_Y # No warning.
+ sprite.set_axis(Vector3.AXIS_Y) # No warning.
diff --git a/modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.out b/modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.out
new file mode 100644
index 0000000000..6c45dee323
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/global_builtin_and_native_enums.out
@@ -0,0 +1,25 @@
+GDTEST_OK
+var test_type_1: Variant.Type = 1
+ hint=ENUM hint_string="Type Nil:0,Type Bool:1,Type Int:2,Type Float:3,Type String:4,Type Vector 2:5,Type Vector 2i:6,Type Rect 2:7,Type Rect 2i:8,Type Vector 3:9,Type Vector 3i:10,Type Transform 2d:11,Type Vector 4:12,Type Vector 4i:13,Type Plane:14,Type Quaternion:15,Type Aabb:16,Type Basis:17,Type Transform 3d:18,Type Projection:19,Type Color:20,Type String Name:21,Type Node Path:22,Type Rid:23,Type Object:24,Type Callable:25,Type Signal:26,Type Dictionary:27,Type Array:28,Type Packed Byte Array:29,Type Packed Int 32 Array:30,Type Packed Int 64 Array:31,Type Packed Float 32 Array:32,Type Packed Float 64 Array:33,Type Packed String Array:34,Type Packed Vector 2 Array:35,Type Packed Vector 3 Array:36,Type Packed Color Array:37,Type Packed Vector 4 Array:38,Type Max:39" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Variant.Type"
+var test_type_2: Variant.Type = 1
+ hint=ENUM hint_string="Type Nil:0,Type Bool:1,Type Int:2,Type Float:3,Type String:4,Type Vector 2:5,Type Vector 2i:6,Type Rect 2:7,Type Rect 2i:8,Type Vector 3:9,Type Vector 3i:10,Type Transform 2d:11,Type Vector 4:12,Type Vector 4i:13,Type Plane:14,Type Quaternion:15,Type Aabb:16,Type Basis:17,Type Transform 3d:18,Type Projection:19,Type Color:20,Type String Name:21,Type Node Path:22,Type Rid:23,Type Object:24,Type Callable:25,Type Signal:26,Type Dictionary:27,Type Array:28,Type Packed Byte Array:29,Type Packed Int 32 Array:30,Type Packed Int 64 Array:31,Type Packed Float 32 Array:32,Type Packed Float 64 Array:33,Type Packed String Array:34,Type Packed Vector 2 Array:35,Type Packed Vector 3 Array:36,Type Packed Color Array:37,Type Packed Vector 4 Array:38,Type Max:39" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Variant.Type"
+var test_type_3: Variant.Type = 0
+ hint=ENUM hint_string="Type Nil:0,Type Bool:1,Type Int:2,Type Float:3,Type String:4,Type Vector 2:5,Type Vector 2i:6,Type Rect 2:7,Type Rect 2i:8,Type Vector 3:9,Type Vector 3i:10,Type Transform 2d:11,Type Vector 4:12,Type Vector 4i:13,Type Plane:14,Type Quaternion:15,Type Aabb:16,Type Basis:17,Type Transform 3d:18,Type Projection:19,Type Color:20,Type String Name:21,Type Node Path:22,Type Rid:23,Type Object:24,Type Callable:25,Type Signal:26,Type Dictionary:27,Type Array:28,Type Packed Byte Array:29,Type Packed Int 32 Array:30,Type Packed Int 64 Array:31,Type Packed Float 32 Array:32,Type Packed Float 64 Array:33,Type Packed String Array:34,Type Packed Vector 2 Array:35,Type Packed Vector 3 Array:36,Type Packed Color Array:37,Type Packed Vector 4 Array:38,Type Max:39" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Variant.Type"
+var test_side_1: Side = 2
+ hint=ENUM hint_string="Side Left:0,Side Top:1,Side Right:2,Side Bottom:3" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Side"
+var test_side_2: Side = 2
+ hint=ENUM hint_string="Side Left:0,Side Top:1,Side Right:2,Side Bottom:3" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Side"
+var test_side_3: Side = 0
+ hint=ENUM hint_string="Side Left:0,Side Top:1,Side Right:2,Side Bottom:3" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Side"
+var test_axis_1: Vector3.Axis = 1
+ hint=ENUM hint_string="Axis X:0,Axis Y:1,Axis Z:2" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Vector3.Axis"
+var test_axis_2: Vector3.Axis = 1
+ hint=ENUM hint_string="Axis X:0,Axis Y:1,Axis Z:2" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Vector3.Axis"
+var test_axis_3: Vector3.Axis = 0
+ hint=ENUM hint_string="Axis X:0,Axis Y:1,Axis Z:2" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Vector3.Axis"
+var test_mode_1: Node.ProcessMode = 3
+ hint=ENUM hint_string="Process Mode Inherit:0,Process Mode Pausable:1,Process Mode When Paused:2,Process Mode Always:3,Process Mode Disabled:4" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Node.ProcessMode"
+var test_mode_2: Node.ProcessMode = 3
+ hint=ENUM hint_string="Process Mode Inherit:0,Process Mode Pausable:1,Process Mode When Paused:2,Process Mode Always:3,Process Mode Disabled:4" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Node.ProcessMode"
+var test_mode_3: Node.ProcessMode = 0
+ hint=ENUM hint_string="Process Mode Inherit:0,Process Mode Pausable:1,Process Mode When Paused:2,Process Mode Always:3,Process Mode Disabled:4" usage=DEFAULT|SCRIPT_VARIABLE|CLASS_IS_ENUM class_name=&"Node.ProcessMode"