]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add test for ":LspDiagCurrent!"
authorAndreas Louv <andreas@louv.dk>
Sun, 2 Apr 2023 23:21:31 +0000 (01:21 +0200)
committerAndreas Louv <andreas@louv.dk>
Sun, 2 Apr 2023 23:40:54 +0000 (01:40 +0200)
test/clangd_tests.vim

index 07fd96026c4d443dd8d4916f45a336c51b22040f..a46342f34e3fad9bc7cd07ce3d7717291b4255e3 100644 (file)
@@ -404,6 +404,37 @@ def g:Test_LspDiag_Multi()
   endfor
   g:LspOptionsSet({showDiagInPopup: true})
 
+  # Check for exact diag ":LspDiagCurrent!"
+  g:LspOptionsSet({showDiagInPopup: false})
+  for i in range(1, 4)
+    cursor(1, i)
+    output = execute('LspDiagCurrent!')->split('\n')
+    assert_match('No diagnostic messages found for current line', output[0])
+  endfor
+
+  cursor(1, 5)
+  output = execute('LspDiagCurrent!')->split('\n')
+  assert_match('Incompatible pointer to integer', output[0])
+
+  for i in range(6, 8)
+    cursor(1, i)
+    output = execute('LspDiagCurrent!')->split('\n')
+    assert_match('No diagnostic messages found for current line', output[0])
+  endfor
+
+  for i in range(9, 11)
+    cursor(1, i)
+    output = execute('LspDiagCurrent!')->split('\n')
+    assert_match('Initializer element is not ', output[0])
+  endfor
+  for i in range(12, 12)
+    cursor(1, i)
+    output = execute('LspDiagCurrent!')->split('\n')
+    assert_match('No diagnostic messages found for current line', output[0])
+  endfor
+
+  g:LspOptionsSet({showDiagInPopup: true})
+
   bw!
 enddef