diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-06 17:07:18 -0500 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-06 17:07:18 -0500 |
| commit | f014cbc3ab5d6c0165c4728c1d89f87ea18274e1 (patch) | |
| tree | f8e30752fe87ec6d3e22732ebd420c37f463d335 /tests | |
| parent | 1bb943a0b5a4a418d880161d4801897b0e9af7f6 (diff) | |
Reintroduce fallback code for selector exprs
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 557a14a..0f9aded 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -4951,3 +4951,80 @@ ast_completion_selector_after_selector_call_expr :: proc(t: ^testing.T) { } test.expect_completion_docs(t, &source, "", {"Data.x: int", "Data.y: int"}) } + +@(test) +ast_completion_empty_selector_before_label :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + bar: int, + } + + main :: proc() { + foo: Foo + foo.{*} + + Label: { + + } + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: int"}) +} + +@(test) +ast_completion_empty_selector_if_init :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + bar: int, + } + + main :: proc() { + foo: Foo + if bar := foo.{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: int"}) +} + +@(test) +ast_completion_empty_selector_switch_init :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Bar :: enum { + A, B, + } + + Foo :: struct { + bar: Bar, + } + + main :: proc() { + foo: Foo + switch bar := foo.{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: test.Bar"}) +} + +@(test) +ast_completion_empty_selector_for_init :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + bars: [5]int, + } + + main :: proc() { + foo: Foo + for bars := foo.{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bars: [5]int"}) +} |