diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-30 20:09:39 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-30 20:09:39 +0100 |
| commit | bcc88f72fc7b2fcf55311a1676e22e2723c1da90 (patch) | |
| tree | 5730182c9e4145962a0406d5297de8b60bead208 /src/testing/testing.odin | |
| parent | a07efabcc54bea23707c4fa5e558f68f90ce42fa (diff) | |
Fix union poly types
Diffstat (limited to 'src/testing/testing.odin')
| -rw-r--r-- | src/testing/testing.odin | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/testing/testing.odin b/src/testing/testing.odin index 0703708..bd4e39b 100644 --- a/src/testing/testing.odin +++ b/src/testing/testing.odin @@ -160,6 +160,41 @@ expect_signature_parameter_position :: proc(t: ^testing.T, src: ^Source, positio } } +expect_completion_labels :: proc(t: ^testing.T, src: ^Source, trigger_character: string, expect_labels: []string) { + setup(src); + + completion_context := server.CompletionContext { + triggerCharacter = trigger_character, + }; + + completion_list, ok := server.get_completion_list(src.document, src.position, completion_context); + + if !ok { + testing.error(t, "Failed get_completion_list"); + } + + if len(expect_labels) == 0 && len(completion_list.items) > 0 { + testing.errorf(t, "Expected empty completion label, but received %v", completion_list.items); + } + + flags := make([]int, len(expect_labels)); + + for expect_label, i in expect_labels { + for completion, j in completion_list.items { + if expect_label == completion.label { + flags[i] += 1; + } + } + } + + for flag, i in flags { + if flag != 1 { + testing.errorf(t, "Expected completion detail %v, but received %v", expect_labels[i], completion_list.items); + } + } + +} + expect_completion_details :: proc(t: ^testing.T, src: ^Source, trigger_character: string, expect_details: []string) { setup(src); |