summaryrefslogtreecommitdiff
path: root/src/testing
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 /src/testing
parent23b5c69f52b0007a6727bd04a5fe373e97df0739 (diff)
feat: add completion edit text test for proc group with single argument
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.odin44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/testing/testing.odin b/src/testing/testing.odin
index 20327a7..0ba7b0f 100644
--- a/src/testing/testing.odin
+++ b/src/testing/testing.odin
@@ -321,6 +321,50 @@ expect_completion_insert_text :: proc(
}
}
+expect_completion_edit_text :: proc(
+ t: ^testing.T,
+ src: ^Source,
+ trigger_character: string,
+ label: string,
+ expected_text: string,
+) {
+ setup(src)
+ defer teardown(src)
+
+ completion_context := server.CompletionContext {
+ triggerCharacter = trigger_character,
+ }
+
+ completion_list, ok := server.get_completion_list(src.document, src.position, completion_context, &src.config)
+
+ if !ok {
+ log.error("Failed get_completion_list")
+ }
+
+ found := false
+ for completion in completion_list.items {
+ if completion.label == label {
+ found = true
+ if text_edit, has_edit := completion.textEdit.(server.TextEdit); has_edit {
+ if text_edit.newText != expected_text {
+ log.errorf(
+ "Completion '%v' expected textEdit.newText %q, but received %q",
+ label,
+ expected_text,
+ text_edit.newText,
+ )
+ }
+ } else {
+ log.errorf("Completion '%v' has no textEdit", label)
+ }
+ break
+ }
+ }
+ if !found {
+ log.errorf("Expected completion label '%v' not found in %v", label, completion_list.items)
+ }
+}
+
expect_hover :: proc(t: ^testing.T, src: ^Source, expect_hover_string: string) {
setup(src)
defer teardown(src)