From 8b634b23407a47319d79d14ab3348f37db0936f9 Mon Sep 17 00:00:00 2001
From: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon, 3 Apr 2023 19:56:59 -0700
Subject: [PATCH] Upgrade CI to clangd-15

---
 .github/workflows/unitests.yml |  2 +-
 test/clangd_tests.vim          | 21 +++++++++++----------
 test/run_tests.cmd             |  2 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/unitests.yml b/.github/workflows/unitests.yml
index 6dc7144..a729521 100644
--- a/.github/workflows/unitests.yml
+++ b/.github/workflows/unitests.yml
@@ -9,7 +9,7 @@ jobs:
         run: |
           sudo apt update
           # install clangd language server
-          sudo apt install -y clangd-14
+          sudo apt install -y clangd-15
           # install nodejs
           sudo apt install -y curl
           curl -fsSL https://deb.nodesource.com/setup_18.x | sudo bash -
diff --git a/test/clangd_tests.vim b/test/clangd_tests.vim
index 2bee098..03ec567 100644
--- a/test/clangd_tests.vim
+++ b/test/clangd_tests.vim
@@ -8,7 +8,7 @@ g:LspOptionsSet(lspOpts)
 
 var lspServers = [{
       filetype: ['c', 'cpp'],
-      path: (exepath('clangd-14') ?? exepath('clangd')),
+      path: (exepath('clangd-15') ?? exepath('clangd')),
       args: ['--background-index', '--clang-tidy'],
       initializationOptions: { clangdFileStatus: true },
       customNotificationHandlers: {
@@ -18,7 +18,7 @@ var lspServers = [{
       }
   }]
 call LspAddServer(lspServers)
-echomsg systemlist($'{lspServers[0].path} --version')
+echomsg systemlist($'{shellescape(lspServers[0].path)} --version')
 
 # Test for formatting a file using LspFormat
 def g:Test_LspFormat()
@@ -351,20 +351,21 @@ def g:Test_LspDiag_Multi()
 
   var bnr: number = bufnr()
 
-  setline(1, [
-    'int i = "a";',
-    'int j = i;',
-    'int y = 0;'
-  ])
+  var lines =<< trim END
+    int i = "a";
+    int j = i;
+    int y = 0;
+  END
+  setline(1, lines)
   :redraw!
   # TODO: Waiting count doesn't include Warning, Info, and Hint diags
-  g:WaitForServerFileLoad(2)
+  g:WaitForServerFileLoad(3)
   :LspDiagShow
   var qfl: list<dict<any>> = getloclist(0)
   assert_equal('quickfix', getwinvar(winnr('$'), '&buftype'))
   assert_equal(bnr, qfl[0].bufnr)
   assert_equal(3, qfl->len())
-  assert_equal([1, 5, 'W'], [qfl[0].lnum, qfl[0].col, qfl[0].type])
+  assert_equal([1, 5, 'E'], [qfl[0].lnum, qfl[0].col, qfl[0].type])
   assert_equal([1, 9, 'E'], [qfl[1].lnum, qfl[1].col, qfl[1].type])
   assert_equal([2, 9, 'E'], [qfl[2].lnum, qfl[2].col, qfl[2].type])
   close
@@ -952,7 +953,7 @@ def g:Test_LspHover()
     }
   END
   setline(1, lines)
-  g:WaitForServerFileLoad(0)
+  g:WaitForServerFileLoad(1)
   cursor(8, 4)
   var output = execute(':LspHover')->split("\n")
   assert_equal([], output)
diff --git a/test/run_tests.cmd b/test/run_tests.cmd
index 925ab7a..863d06d 100644
--- a/test/run_tests.cmd
+++ b/test/run_tests.cmd
@@ -6,7 +6,7 @@ SETLOCAL
 SET VIMPRG="vim.exe"
 SET VIM_CMD=%VIMPRG% -u NONE -U NONE -i NONE --noplugin -N --not-a-term
 
-%VIM_CMD% -c "let g:TestName=clangd_tests.vim" -S runner.vim
+%VIM_CMD% -c "let g:TestName='clangd_tests.vim'" -S runner.vim
 
 echo LSP unit test results
 type results.txt
-- 
2.51.0