diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-12 20:32:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-12 20:32:30 -0400 |
| commit | dfdeeaec1b52b6c3c66d224ee6433aad47903afd (patch) | |
| tree | 6562a77bbec1e00e0cf602588d3d3f7f283e2464 /tests | |
| parent | d464ae4f65d41fa9abbac656cbfa804af3662162 (diff) | |
| parent | 0703d58d1823fcaebb4b7d302b2bc6f8c9cc941e (diff) | |
Merge pull request #869 from BradLewis/fix/completions-enum-maps
Correctly resolve completions for comp lit map with enum keys and values
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index ca1d5a5..339b195 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -4343,3 +4343,49 @@ ast_completion_within_struct_decl :: proc(t: ^testing.T) { } test.expect_completion_docs( t, &source, "", {"test.Foo: enum {..}"}, {"test.foo: proc(f: Foo)"}) } + +@(test) +ast_completion_enum_map_key_global :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + E :: enum { A, B, C } + + m: map[E]int = { + .{*} + } + `, + } + + test.expect_completion_docs(t, &source, "", {"A", "B", "C"}) +} + +@(test) +ast_completion_enum_map_key_global_with_value :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + E :: enum { A, B, C } + + m: map[E]int = { + .{*} = 0, + } + `, + } + + test.expect_completion_docs(t, &source, "", {"A", "B", "C"}) +} + +@(test) +ast_completion_enum_map_value_global :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + E :: enum { A, B, C } + + m: map[int]E = { + 0 = .A, + 1 = .{*} + } + `, + } + + test.expect_completion_docs(t, &source, "", {"A", "B", "C"}) +} |