From: shane.xb.qian Date: Sun, 16 Apr 2023 00:11:38 +0000 (+0800) Subject: fix: adjust err/wrn msg in test X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3d7ec8d89fb1885340f53c4f50fe7d3b0d35b14d;p=vim-lsp.git fix: adjust err/wrn msg in test Signed-off-by: shane.xb.qian --- diff --git a/test/clangd_tests.vim b/test/clangd_tests.vim index 28c2ea8..27a0b8b 100644 --- a/test/clangd_tests.vim +++ b/test/clangd_tests.vim @@ -113,7 +113,7 @@ def g:Test_LspFormat() # file without an LSP server edit a.raku - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspFormat')->split("\n")) :%bw! @@ -231,7 +231,7 @@ def g:Test_LspShowReferences() # file without an LSP server edit a.raku - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspShowReferences')->split("\n")) :%bw! @@ -267,11 +267,11 @@ def g:Test_LspDiag() g:LspOptionsSet({showDiagInPopup: false}) normal gg var output = execute('LspDiagCurrent')->split("\n") - assert_equal('No diagnostic messages found for current line', output[0]) + assert_match('No diagnostic messages found for current line', output[0]) :LspDiagFirst assert_equal([3, 14], [line('.'), col('.')]) output = execute('LspDiagCurrent')->split("\n") - assert_equal("Expected ';' at end of declaration (fix available)", output[0]) + assert_match("Expected ';' at end of declaration (fix available)", output[0]) :normal! 0 :LspDiagHere assert_equal([3, 14], [line('.'), col('.')]) @@ -280,12 +280,12 @@ def g:Test_LspDiag() :LspDiagNext assert_equal([7, 2], [line('.'), col('.')]) output = execute('LspDiagNext')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) :LspDiagPrev :LspDiagPrev :LspDiagPrev output = execute('LspDiagPrev')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) # :[count]LspDiagNext cursor(3, 1) @@ -294,14 +294,14 @@ def g:Test_LspDiag() :2LspDiagNext assert_equal([7, 2], [line('.'), col('.')]) output = execute(':2LspDiagNext')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) # :[count]LspDiagPrev cursor(7, 2) :4LspDiagPrev assert_equal([3, 14], [line('.'), col('.')]) output = execute(':4LspDiagPrev')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) :%d setline(1, ['void blueFunc()', '{', '}']) @@ -391,7 +391,7 @@ def g:Test_LspDiag_Multi() assert_equal([1, 5], [line('.'), col('.')]) var output = execute('LspDiagPrev')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) cursor(2, 1) assert_equal('', execute('LspDiagFirst')) @@ -422,7 +422,7 @@ def g:Test_LspDiag_Multi() # Line without diagnostics cursor(3, 1) output = execute('LspDiagHere')->split("\n") - assert_equal('Error: No more diagnostics found on this line', output[0]) + assert_match('No more diagnostics found on this line', output[0]) g:LspOptionsSet({showDiagInPopup: false}) for i in range(1, 5) @@ -476,7 +476,7 @@ def g:Test_LspDiag_Multi() :2LspDiagNext assert_equal([2, 9], [line('.'), col('.')]) output = execute(':2LspDiagNext')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) cursor(1, 1) :99LspDiagNext @@ -494,7 +494,7 @@ def g:Test_LspDiag_Multi() :2LspDiagPrev assert_equal([1, 5], [line('.'), col('.')]) output = execute(':2LspDiagPrev')->split("\n") - assert_equal('Error: No more diagnostics found', output[0]) + assert_match('No more diagnostics found', output[0]) cursor(3, 3) :99LspDiagPrev @@ -614,7 +614,7 @@ def g:Test_LspCodeAction() # file without an LSP server edit a.raku - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspCodeAction')->split("\n")) :%bw! @@ -684,7 +684,7 @@ def g:Test_LspRename() # file without an LSP server edit a.raku - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspRename')->split("\n")) :%bw! @@ -784,7 +784,7 @@ def g:Test_LspSelection() # file without an LSP server edit a.raku - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspSelectionExpand')->split("\n")) :%bw! @@ -871,15 +871,15 @@ def g:Test_LspGotoSymbol() cursor(11, 5) :LspGotoDeclaration var m = execute('messages')->split("\n") - assert_equal('Error: symbol declaration is not found', m[1]) + assert_match('symbol declaration is not found', m[1]) :messages clear :LspGotoDefinition m = execute('messages')->split("\n") - assert_equal('Error: symbol definition is not found', m[1]) + assert_match('symbol definition is not found', m[1]) :messages clear :LspGotoImpl m = execute('messages')->split("\n") - assert_equal('Error: symbol implementation is not found', m[1]) + assert_match('symbol implementation is not found', m[1]) :messages clear endif @@ -917,11 +917,11 @@ def g:Test_LspGotoSymbol() # file without an LSP server edit a.raku - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspGotoDefinition')->split("\n")) - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspGotoDeclaration')->split("\n")) - assert_equal(['Error: Language server for "raku" file type is not found'], + assert_match(['Language server for "raku" file type is not found'], execute('LspGotoImpl')->split("\n")) :%bw! @@ -998,7 +998,7 @@ def g:Test_LspHover() popup_close(p[0]) cursor(7, 1) output = execute(':LspHover')->split("\n") - assert_equal('No hover messages found for current position', output[0]) + assert_match('No hover messages found for current position', output[0]) output = execute(':silent LspHover')->split("\n") assert_equal([], output) assert_equal([], popup_list()) @@ -1093,7 +1093,7 @@ def g:Test_LspSymbolSearch() assert_equal([5, 6], [line('.'), col('.')]) var output = execute(':LspSymbolSearch lsptest_nonexist')->split("\n") - assert_equal(['Error: Symbol "lsptest_nonexist" is not found'], output) + assert_match(['Symbol "lsptest_nonexist" is not found'], output) :%bw! enddef