aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-10-08 14:01:55 -0700
committerGitHub <noreply@github.com>2021-10-08 14:01:55 -0700
commit4f4dbfe81c27eab661ca9bb83d1c559c213d77f4 (patch)
tree36ba57e2cef511216a29da70acc8799e0ce10610
parentfcc11d5942779b57257a75e995068fedbf116e34 (diff)
downloadrneovim-4f4dbfe81c27eab661ca9bb83d1c559c213d77f4.tar.gz
rneovim-4f4dbfe81c27eab661ca9bb83d1c559c213d77f4.tar.bz2
rneovim-4f4dbfe81c27eab661ca9bb83d1c559c213d77f4.zip
fix(lsp): update tests using 0.5.0 handler calls (#15969)
Fixes test regression introduced in https://github.com/neovim/neovim/pull/15262
-rw-r--r--test/functional/fixtures/fake-lsp-server.lua4
-rw-r--r--test/functional/plugin/lsp_spec.lua21
2 files changed, 13 insertions, 12 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua
index c102a98002..9abf478070 100644
--- a/test/functional/fixtures/fake-lsp-server.lua
+++ b/test/functional/fixtures/fake-lsp-server.lua
@@ -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')
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index f5c02afeaa..026e6815dc 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -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)