mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
fix(lsp_spec): tests depended on previous session
backport #15803 - fix tests which accidentally depended on previous session
This commit is contained in:
@@ -132,38 +132,35 @@ end
|
||||
describe('LSP', function()
|
||||
before_each(function()
|
||||
clear_notrace()
|
||||
-- Run an instance of nvim on the file which contains our "scripts".
|
||||
-- Pass TEST_NAME to pick the script.
|
||||
local test_name = "basic_init"
|
||||
exec_lua([=[
|
||||
lsp = require('vim.lsp')
|
||||
local test_name, fixture_filename, logfile = ...
|
||||
function test__start_client()
|
||||
return lsp.start_client {
|
||||
cmd_env = {
|
||||
NVIM_LOG_FILE = logfile;
|
||||
};
|
||||
cmd = {
|
||||
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
||||
"-c", string.format("lua TEST_NAME = %q", test_name),
|
||||
"-c", "luafile "..fixture_filename;
|
||||
};
|
||||
root_dir = vim.loop.cwd();
|
||||
}
|
||||
end
|
||||
TEST_CLIENT1 = test__start_client()
|
||||
]=], test_name, fake_lsp_code, fake_lsp_logfile)
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
exec_lua("lsp._vim_exit_handler()")
|
||||
-- exec_lua("lsp.stop_all_clients(true)")
|
||||
end)
|
||||
|
||||
describe('server_name specified', function()
|
||||
before_each(function()
|
||||
-- Run an instance of nvim on the file which contains our "scripts".
|
||||
-- Pass TEST_NAME to pick the script.
|
||||
local test_name = "basic_init"
|
||||
exec_lua([=[
|
||||
lsp = require('vim.lsp')
|
||||
local test_name, fixture_filename, logfile = ...
|
||||
function test__start_client()
|
||||
return lsp.start_client {
|
||||
cmd_env = {
|
||||
NVIM_LOG_FILE = logfile;
|
||||
};
|
||||
cmd = {
|
||||
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
||||
"-c", string.format("lua TEST_NAME = %q", test_name),
|
||||
"-c", "luafile "..fixture_filename;
|
||||
};
|
||||
root_dir = vim.loop.cwd();
|
||||
}
|
||||
end
|
||||
TEST_CLIENT1 = test__start_client()
|
||||
]=], test_name, fake_lsp_code, fake_lsp_logfile)
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
exec_lua("lsp._vim_exit_handler()")
|
||||
-- exec_lua("lsp.stop_all_clients(true)")
|
||||
end)
|
||||
|
||||
it('start_client(), stop_client()', function()
|
||||
retry(nil, 4000, function()
|
||||
eq(1, exec_lua('return #lsp.get_active_clients()'))
|
||||
|
Reference in New Issue
Block a user