aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-20 08:50:19 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-20 08:50:19 -0400
commitcad50369b0756958e826d7e964b1a3b7ed1504d5 (patch)
tree11c19677b34befd6d98d2d5613733cf7ea5f0671 /tests
parent7ff84eb0b24912db1b3f3b0cff323e1728f47b0b (diff)
Check to see if completion already includes `&` before adding it when matching
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index d3a2eb7..7b42568 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -4698,3 +4698,43 @@ ast_completion_struct_field_value :: proc(t: ^testing.T) {
}
test.expect_completion_docs(t, &source, "", {"test.Foo: struct {}"})
}
+
+@(test)
+ast_completion_handle_matching_with_unary :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct{}
+
+ do_foo :: proc(foo: ^Foo){}
+
+ main :: proc() {
+ foo: Foo
+ do_foo(&f{*})
+ }
+ `,
+ config = {
+ enable_completion_matching = true,
+ },
+ }
+ test.expect_completion_insert_text(t, &source, "", {"foo"})
+}
+
+@(test)
+ast_completion_handle_matching_field_with_unary :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct{}
+
+ do_foo :: proc(foo: ^Foo){}
+
+ main :: proc() {
+ foo: Foo
+ do_foo(foo = &f{*})
+ }
+ `,
+ config = {
+ enable_completion_matching = true,
+ },
+ }
+ test.expect_completion_insert_text(t, &source, "", {"foo"})
+}