Merge pull request #18693 from bfredl/quicklsp

fix(ci): remove 2000ms blocking wait in many plugin/lsp_spec.lua tests
This commit is contained in:
bfredl 2022-05-22 16:25:17 +02:00 committed by GitHub
commit 9b34723bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,10 +222,32 @@ describe('LSP', function()
end) end)
end) end)
describe('lsp._cmd_parts test', function()
local function _cmd_parts(input)
return exec_lua([[
lsp = require('vim.lsp')
return lsp._cmd_parts(...)
]], input)
end
it('should valid cmd argument', function()
eq(true, pcall(_cmd_parts, {"nvim"}))
eq(true, pcall(_cmd_parts, {"nvim", "--head"}))
end)
it('should invalid cmd argument', function()
eq('Error executing lua: .../lsp.lua:0: cmd: expected list, got nvim',
pcall_err(_cmd_parts, 'nvim'))
eq('Error executing lua: .../lsp.lua:0: cmd argument: expected string, got number',
pcall_err(_cmd_parts, {'nvim', 1}))
end)
end)
end)
describe('LSP', function()
describe('basic_init test', function() describe('basic_init test', function()
after_each(function() after_each(function()
stop() stop()
exec_lua("lsp.stop_client(lsp.get_active_clients())") exec_lua("lsp.stop_client(lsp.get_active_clients(), true)")
exec_lua("lsp._vim_exit_handler()") exec_lua("lsp._vim_exit_handler()")
end) end)
@ -424,16 +446,23 @@ describe('LSP', function()
} }
end) end)
it('workspace/configuration returns NIL per section if client was started without config.settings', function() it('workspace/configuration returns NIL per section if client was started without config.settings', function()
fake_lsp_server_setup('workspace/configuration no settings') local result = nil
eq({ NIL, NIL, }, exec_lua [[ test_rpc_server {
local result = { test_name = 'basic_init';
items = { on_init = function(c) c.stop() end,
{section = 'foo'}, on_setup = function()
{section = 'bar'}, result = exec_lua [[
} local result = {
} items = {
return vim.lsp.handlers['workspace/configuration'](nil, result, {client_id=TEST_RPC_CLIENT_ID}) {section = 'foo'},
]]) {section = 'bar'},
}
}
return vim.lsp.handlers['workspace/configuration'](nil, result, {client_id=TEST_RPC_CLIENT_ID})
]]
end
}
eq({ NIL, NIL }, result)
end) end)
it('should verify capabilities sent', function() it('should verify capabilities sent', function()
@ -1345,25 +1374,6 @@ describe('LSP', function()
} }
end) end)
end) end)
describe('lsp._cmd_parts test', function()
local function _cmd_parts(input)
return exec_lua([[
lsp = require('vim.lsp')
return lsp._cmd_parts(...)
]], input)
end
it('should valid cmd argument', function()
eq(true, pcall(_cmd_parts, {"nvim"}))
eq(true, pcall(_cmd_parts, {"nvim", "--head"}))
end)
it('should invalid cmd argument', function()
eq('Error executing lua: .../lsp.lua:0: cmd: expected list, got nvim',
pcall_err(_cmd_parts, 'nvim'))
eq('Error executing lua: .../lsp.lua:0: cmd argument: expected string, got number',
pcall_err(_cmd_parts, {'nvim', 1}))
end)
end)
end) end)
describe('LSP', function() describe('LSP', function()