From 86c39dd5669b8aac89dd6237d98fcedd82d2a666 Mon Sep 17 00:00:00 2001 From: Daniel Gavin Date: Sat, 1 May 2021 22:55:10 +0200 Subject: more tests + added default values in proc resolving --- src/testing/testing.odin | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/testing/testing.odin') diff --git a/src/testing/testing.odin b/src/testing/testing.odin index 001b8cf..5bb8d63 100644 --- a/src/testing/testing.odin +++ b/src/testing/testing.odin @@ -134,7 +134,21 @@ expect_completion_details :: proc(t: ^testing.T, src: ^Source, trigger_character } -expect_hover :: proc(t: ^testing.T, src: ^Source, expect_hover_info: string) { +expect_hover :: proc(t: ^testing.T, src: ^Source, expect_hover_string: string) { setup(src); + hover, ok := server.get_hover_information(src.document, src.position); + + if !ok { + testing.error(t, "Failed get_hover_information"); + } + + if expect_hover_string == "" && hover.contents.value != "" { + testing.errorf(t, "Expected empty hover string, but received %v", hover.contents.value); + } + + if strings.contains(expect_hover_string, hover.contents.value) { + testing.errorf(t, "Expected hover string %v, but received %v", expect_hover_string, hover.contents.value); + } + } -- cgit v1.2.3