diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2026-01-29 13:06:05 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-29 13:06:05 +1100 |
| commit | 791b0cd1c199880574d9377a56c6569a1831efd8 (patch) | |
| tree | c29edc8547a3ab7adcdbfd71816e5a43519287e5 /src/testing/testing.odin | |
| parent | 22f7394233da7b68ce78d370d62105456bdaecb0 (diff) | |
| parent | ee962b842b6d2fc6f73a427301289e2d19b38c40 (diff) | |
Merge pull request #1265 from pnarimani/fake_method_group
Fake Proc Group Methods
Diffstat (limited to 'src/testing/testing.odin')
| -rw-r--r-- | src/testing/testing.odin | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/testing/testing.odin b/src/testing/testing.odin index 2013f79..0ba7b0f 100644 --- a/src/testing/testing.odin +++ b/src/testing/testing.odin @@ -68,6 +68,9 @@ setup :: proc(src: ^Source) { server.setup_index() + // Set the collection's config to the test's config to enable feature flags like enable_fake_method + server.indexer.index.collection.config = &src.config + server.document_setup(src.document) server.document_refresh(src.document, &src.config, nil) @@ -318,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) |