fix(lsp): update tests using 0.5.0 handler calls (#15969)

Fixes test regression introduced in https://github.com/neovim/neovim/pull/15262
This commit is contained in:
Michael Lingelbach 2021-10-08 14:01:55 -07:00 committed by GitHub
parent fcc11d5942
commit 4f4dbfe81c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -253,7 +253,7 @@ function tests.check_forward_request_cancelled()
end;
body = function()
expect_request("error_code_test", function()
return {code = -32800}, nil
return {code = -32800}, nil, {method = "error_code_test", client_id=1}
end)
notify('finish')
end;
@ -267,7 +267,7 @@ function tests.check_forward_content_modified()
end;
body = function()
expect_request("error_code_test", function()
return {code = -32801}, nil
return {code = -32801}, nil, {method = "error_code_test", client_id=1}
end)
expect_notification('finish')
notify('finish')

View File

@ -482,7 +482,7 @@ describe('LSP', function()
it('should not forward RequestCancelled to callback', function()
local expected_handlers = {
{NIL, "finish", {}, 1};
{NIL, {}, {method="finish", client_id=1}};
}
local client
test_rpc_server {
@ -496,17 +496,17 @@ describe('LSP', function()
eq(0, signal, "exit signal", fake_lsp_logfile)
eq(0, #expected_handlers, "did not call expected handler")
end;
on_handler = function(err, method, ...)
eq(table.remove(expected_handlers), {err, method, ...}, "expected handler")
if method == 'finish' then client.stop() end
on_handler = function(err, _, ctx)
eq(table.remove(expected_handlers), {err, {}, ctx}, "expected handler")
if ctx.method == 'finish' then client.stop() end
end;
}
end)
it('should forward ContentModified to callback', function()
local expected_handlers = {
{NIL, "finish", {}, 1};
{{code = -32801}, "error_code_test", NIL, 1, NIL};
{NIL, {}, {method="finish", client_id=1}};
{{code = -32801}, NIL, {method = "error_code_test", client_id=1}};
}
local client
test_rpc_server {
@ -520,10 +520,11 @@ describe('LSP', function()
eq(0, signal, "exit signal", fake_lsp_logfile)
eq(0, #expected_handlers, "did not call expected handler")
end;
on_handler = function(err, method, ...)
eq(table.remove(expected_handlers), {err, method, ...}, "expected handler")
if method == 'error_code_test' then client.notify("finish") end
if method == 'finish' then client.stop() end
on_handler = function(err, _, ctx)
eq(table.remove(expected_handlers), {err, _, ctx}, "expected handler")
-- if ctx.method == 'error_code_test' then client.notify("finish") end
if ctx.method ~= 'finish' then client.notify('finish') end
if ctx.method == 'finish' then client.stop() end
end;
}
end)