aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorpc <pmnarimani@gmail.com>2026-01-27 02:13:42 +0100
committerpc <pmnarimani@gmail.com>2026-01-27 02:13:42 +0100
commit219d0157cf409f23751b719080aa212cc1ebc1f5 (patch)
tree4ffe859f8da3b4371edc151c8745650ae5212119 /tests
parent23b5c69f52b0007a6727bd04a5fe373e97df0739 (diff)
feat: add completion edit text test for proc group with single argument
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 8ed9b43..f0fa8c1 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -5441,3 +5441,30 @@ ast_completion_fake_method_builtin_type_uses_builtin_pkg :: proc(t: ^testing.T)
// the lookup correctly uses "$builtin" instead of "test" for the package
test.expect_completion_labels(t, &source, ".", {"square", "cube"})
}
+
+@(test)
+ast_completion_fake_method_proc_group_single_arg_cursor_position :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ import "methods"
+ main :: proc() {
+ n: int
+ n.{*}
+ }
+ `,
+ packages = {
+ {
+ pkg = "methods",
+ source = `package methods
+ // All members only take a single argument (the receiver)
+ negate_a :: proc(x: int) -> int { return -x }
+ negate_b :: proc(x: int) -> int { return 0 - x }
+ negate :: proc { negate_a, negate_b }
+ `,
+ },
+ },
+ config = {enable_fake_method = true},
+ }
+ // The proc group 'negate' should have cursor AFTER parentheses since no additional args
+ test.expect_completion_edit_text(t, &source, ".", "negate", "methods.negate(n)$0")
+}