summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/parser
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-01-29 15:07:24 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-01-30 12:30:37 +0300
commitd4b78c352f21fa5f07d3bb6184c2a6a88419d6b3 (patch)
treece19c189ad692e17547142aef112a7a80deef3b2 /modules/gdscript/tests/scripts/parser
parentd01ac9c73686fdf86f083f4d3ee1301bb54d855f (diff)
GDScript: Fix `@export_enum` works only with `int`
Diffstat (limited to 'modules/gdscript/tests/scripts/parser')
-rw-r--r--modules/gdscript/tests/scripts/parser/features/export_enum.gd15
-rw-r--r--modules/gdscript/tests/scripts/parser/features/export_enum.out7
2 files changed, 22 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/parser/features/export_enum.gd b/modules/gdscript/tests/scripts/parser/features/export_enum.gd
new file mode 100644
index 0000000000..9b2c22dea1
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/export_enum.gd
@@ -0,0 +1,15 @@
+@export_enum("Red", "Green", "Blue") var untyped
+
+@export_enum("Red", "Green", "Blue") var weak_int = 0
+@export_enum("Red", "Green", "Blue") var weak_string = ""
+
+@export_enum("Red", "Green", "Blue") var hard_int: int
+@export_enum("Red", "Green", "Blue") var hard_string: String
+
+@export_enum("Red:10", "Green:20", "Blue:30") var with_values
+
+func test():
+ for property in get_property_list():
+ if property.name in ["untyped", "weak_int", "weak_string", "hard_int",
+ "hard_string", "with_values"]:
+ prints(property.name, property.type, property.hint_string)
diff --git a/modules/gdscript/tests/scripts/parser/features/export_enum.out b/modules/gdscript/tests/scripts/parser/features/export_enum.out
new file mode 100644
index 0000000000..330b7eaf01
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/export_enum.out
@@ -0,0 +1,7 @@
+GDTEST_OK
+untyped 2 Red,Green,Blue
+weak_int 2 Red,Green,Blue
+weak_string 4 Red,Green,Blue
+hard_int 2 Red,Green,Blue
+hard_string 4 Red,Green,Blue
+with_values 2 Red:10,Green:20,Blue:30