diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-26 21:39:29 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-29 15:49:11 -0400 |
| commit | 83d6bd2630fbcba45a3c912c4a141e4995def4f8 (patch) | |
| tree | 04c40ead41b257642a162e5cde7f4b2afbddf36b /src/testing | |
| parent | 7333f046381ee3e19a8935c797efca09a923fa14 (diff) | |
Fix completion and hover tests with documentation changes
Diffstat (limited to 'src/testing')
| -rw-r--r-- | src/testing/testing.odin | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/testing/testing.odin b/src/testing/testing.odin index 429d393..200645e 100644 --- a/src/testing/testing.odin +++ b/src/testing/testing.odin @@ -201,7 +201,7 @@ expect_completion_labels :: proc(t: ^testing.T, src: ^Source, trigger_character: } } -expect_completion_details :: proc( +expect_completion_docs :: proc( t: ^testing.T, src: ^Source, trigger_character: string, expect_details: []string, @@ -210,6 +210,18 @@ expect_completion_details :: proc( setup(src) defer teardown(src) + get_doc :: proc(doc: server.CompletionDocumention) -> string { + switch v in doc { + case string: + return v + case server.MarkupContent: + first_strip, _ := strings.remove(v.value, "```odin\n", 2, context.temp_allocator) + content_without_markdown, _ := strings.remove(first_strip, "\n```", 2, context.temp_allocator) + return content_without_markdown + } + return "" + } + completion_context := server.CompletionContext { triggerCharacter = trigger_character, } @@ -228,9 +240,9 @@ expect_completion_details :: proc( for expect_detail, i in expect_details { for completion, j in completion_list.items { - if expect_detail == completion.detail { + if expect_detail == get_doc(completion.documentation) { flags[i] += 1 - } + } } } |