From 92ae18d0145dfbb1e1b8279cf969733e96994db3 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 22 Jan 2022 09:59:42 -0800 Subject: [PATCH] Add test for LspHover --- test/unit_tests.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/unit_tests.vim b/test/unit_tests.vim index 4836a9f..297ec1d 100644 --- a/test/unit_tests.vim +++ b/test/unit_tests.vim @@ -561,6 +561,36 @@ def Test_LspHighlight() :%bw! enddef +# Test for :LspHover +def Test_LspHover() + silent! edit Xtest.c + var lines: list =<< trim END + int f1(int a) + { + return 0; + } + + void f2(void) + { + f1(5); + } + END + setline(1, lines) + :sleep 1 + cursor(8, 4) + :LspHover + :sleep 1 + var p: list = popup_list() + assert_equal(1, p->len()) + assert_equal(['function f1', '', '→ int', 'Parameters:', '- int a', '', 'int f1(int a)'], getbufline(winbufnr(p[0]), 1, '$')) + popup_close(p[0]) + cursor(7, 1) + :LspHover + :sleep 1 + assert_equal([], popup_list()) + :%bw! +enddef + def LspRunTests() :set nomore :set debug=beep -- 2.48.1