summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-23 13:54:33 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-23 13:54:33 +0100
commit486b0b690de1b204876367845504cce51b331f9f (patch)
tree8aff412be15ee853dc14b27be24a335c4d28564c /modules/gdscript/tests
parent845f2a801f3fba5a3750fd07e288fc7c94337d63 (diff)
parent7ee011051ace34a5d2091ceda9b3e178283824a2 (diff)
Merge pull request #73796 from vonagam/fix-enum-in-range-call
GDScript: Fix usage of enum value as range argument
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd9
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out2
2 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd
new file mode 100644
index 0000000000..d2d9d04508
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd
@@ -0,0 +1,9 @@
+enum E { E0 = 0, E3 = 3 }
+
+func test():
+ var total := 0
+ for value in range(E.E0, E.E3):
+ var inferable := value
+ total += inferable
+ assert(total == 0 + 1 + 2)
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok