]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Update the tests to reduce the delay
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 26 Mar 2023 03:27:03 +0000 (20:27 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 26 Mar 2023 03:27:03 +0000 (20:27 -0700)
test/clangd_tests.vim
test/common.vim
test/tsserver_tests.vim

index 694f20dbfa9229c80def142aa5f396eb547b6d56..223f0bbc55b4d61a947a75a5477412a345c1ab09 100644 (file)
@@ -184,7 +184,7 @@ def g:Test_LspShowReferences()
   setlocal nomodified
   cursor(10, 6)
   :LspPeekReferences
-  sleep 10m
+  sleep 50m
   var ids = popup_list()
   assert_equal(2, ids->len())
   var filePopupAttrs = ids[0]->popup_getoptions()
@@ -526,9 +526,6 @@ def g:Test_LspGotoSymbol()
   silent! edit Xtest.cpp
   sleep 600m
   var lines: list<string> =<< trim END
-    #include <iostream>
-    using namespace std;
-
     class base {
        public:
            virtual void print();
@@ -553,35 +550,35 @@ def g:Test_LspGotoSymbol()
     }
   END
   setline(1, lines)
-  :sleep 1
+  g:WaitForServerFileLoad(0)
 
-  cursor(24, 6)
+  cursor(21, 6)
   :LspGotoDeclaration
-  assert_equal([6, 19], [line('.'), col('.')])
+  assert_equal([3, 19], [line('.'), col('.')])
   exe "normal! \<C-t>"
-  assert_equal([24, 6], [line('.'), col('.')])
+  assert_equal([21, 6], [line('.'), col('.')])
   assert_equal(1, winnr('$'))
 
   :LspGotoDefinition
-  assert_equal([9, 12], [line('.'), col('.')])
+  assert_equal([6, 12], [line('.'), col('.')])
   exe "normal! \<C-t>"
-  assert_equal([24, 6], [line('.'), col('.')])
+  assert_equal([21, 6], [line('.'), col('.')])
   assert_equal(1, winnr('$'))
 
   # Command modifiers
   :topleft LspGotoDefinition
-  assert_equal([9, 12], [line('.'), col('.')])
+  assert_equal([6, 12], [line('.'), col('.')])
   assert_equal([1, 2], [winnr(), winnr('$')])
   close
   exe "normal! \<C-t>"
-  assert_equal([24, 6], [line('.'), col('.')])
+  assert_equal([21, 6], [line('.'), col('.')])
 
   :tab LspGotoDefinition
-  assert_equal([9, 12], [line('.'), col('.')])
+  assert_equal([6, 12], [line('.'), col('.')])
   assert_equal([2, 2, 1], [tabpagenr(), tabpagenr('$'), winnr('$')])
   tabclose
   exe "normal! \<C-t>"
-  assert_equal([24, 6], [line('.'), col('.')])
+  assert_equal([21, 6], [line('.'), col('.')])
 
   # FIXME: :LspGotoTypeDef and :LspGotoImpl are supported only with clang-14.
   # This clangd version is not available in Github CI.
@@ -590,7 +587,7 @@ def g:Test_LspGotoSymbol()
   # FIXME: The following tests are failing in Github CI. Comment out for now.
   if 0
   :messages clear
-  cursor(14, 5)
+  cursor(11, 5)
   :LspGotoDeclaration
   var m = execute('messages')->split("\n")
   assert_equal('Error: declaration is not found', m[1])
@@ -605,13 +602,13 @@ def g:Test_LspGotoSymbol()
   endif
 
   # Test for LspPeekDeclaration
-  cursor(24, 6)
+  cursor(21, 6)
   var bnum = bufnr()
   :LspPeekDeclaration
   var plist = popup_list()
   assert_true(1, plist->len())
   assert_equal(bnum, plist[0]->winbufnr())
-  assert_equal(6, line('.', plist[0]))
+  assert_equal(3, line('.', plist[0]))
   popup_clear()
   # tag stack should not be changed
   assert_fails("normal! \<C-t>", 'E555:')
@@ -621,7 +618,7 @@ def g:Test_LspGotoSymbol()
   plist = popup_list()
   assert_true(1, plist->len())
   assert_equal(bnum, plist[0]->winbufnr())
-  assert_equal(9, line('.', plist[0]))
+  assert_equal(6, line('.', plist[0]))
   popup_clear()
   # tag stack should not be changed
   assert_fails("normal! \<C-t>", 'E555:')
index cbfd75e0f069f8b74fb8ca751c5fb3521c514848..2ea67af0396af28446cebb4f5b83900f75c33a97 100644 (file)
@@ -101,16 +101,16 @@ func g:WaitFor(expr, ...)
 endfunc
 
 # Wait for diagnostic messages from the LSP server.
-# Waits for a maximum of (10 * 2000) / 1000 = 20 seconds
+# Waits for a maximum of (100 * 200) / 1000 = 20 seconds
 def g:WaitForDiags(errCount: number)
   var retries = 0
-  while retries < 2000
+  while retries < 200
     var d = lsp#lsp#ErrorCount()
     if d.Error == errCount
       break
     endif
     retries += 1
-    :sleep 10m
+    :sleep 100m
   endwhile
 
   assert_equal(errCount, lsp#lsp#ErrorCount().Error)
index 68f51845ef1638bc208cb344aae94f473c7bb958..156cfc8daa60c9a4f5e53d3f251b351af7ffc2a9 100644 (file)
@@ -31,7 +31,6 @@ def g:Test_LspDiag()
 
   setline(1, lines)
   :redraw!
-  :sleep 3
   g:WaitForServerFileLoad(5)
   :LspDiagShow
   var qfl: list<dict<any>> = getloclist(0)
@@ -116,7 +115,6 @@ def g:Test_LspGoto()
 
   setline(1, lines)
   :redraw!
-  :sleep 3
   g:WaitForServerFileLoad(0)
 
   cursor(8, 1)