aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-08-10 18:36:21 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-08-10 18:36:21 +0200
commit62a7d1d93da8499fa5e85489842d25ab54e0fac2 (patch)
tree3c218e9c4107eade9298d2d1b00209a89f63f4ce /tests
parent7c29d7fa223e4ae6baddadc6b24798098fdba98a (diff)
Add support for enumerated arrays in range loop.
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index c66d44c..ac74117 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -2823,6 +2823,34 @@ ast_enumerated_array_index_completion :: proc(t: ^testing.T) {
test.expect_completion_labels(t, &source, ".", {"North", "East", "South", "West"})
}
+
+@(test)
+ast_enumerated_array_range_completion :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package main
+ Enum :: enum {
+ Foo,
+ Bar,
+ Baz,
+ }
+
+ ARRAY :: [Enum]string{
+ .Foo = "foo",
+ .Bar = "bar",
+ .Baz = "baz",
+ }
+
+ main :: proc() {
+ for item, indezx in ARRAY {
+ indez{*}
+ }
+ }
+ `,
+ }
+
+ test.expect_completion_details(t, &source, "", {"test.indezx: Enum"})
+}
+
@(test)
ast_raw_data_slice :: proc(t: ^testing.T) {
source := test.Source {