aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 17:18:27 -0500
committerGitHub <noreply@github.com>2025-11-06 17:18:27 -0500
commite466dde8a720fe8c9653aed200190dcfeb0d640e (patch)
treef8e30752fe87ec6d3e22732ebd420c37f463d335 /tests
parent1bb943a0b5a4a418d880161d4801897b0e9af7f6 (diff)
parentf014cbc3ab5d6c0165c4728c1d89f87ea18274e1 (diff)
Merge pull request #1160 from BradLewis/fix/reintroduce-selector-fallback-code
Reintroduce fallback code for selector exprs
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin77
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"})
+}