diff options
Diffstat (limited to 'test/functional/fixtures')
22 files changed, 101 insertions, 79 deletions
diff --git a/test/functional/fixtures/api_level_11.mpack b/test/functional/fixtures/api_level_11.mpack Binary files differnew file mode 100644 index 0000000000..2399854c42 --- /dev/null +++ b/test/functional/fixtures/api_level_11.mpack diff --git a/test/functional/fixtures/autoload/health/broken.vim b/test/functional/fixtures/autoload/health/broken.vim deleted file mode 100644 index a2a595b96f..0000000000 --- a/test/functional/fixtures/autoload/health/broken.vim +++ /dev/null @@ -1,3 +0,0 @@ -function! health#broken#check() - throw 'caused an error' -endfunction diff --git a/test/functional/fixtures/autoload/health/full_render.vim b/test/functional/fixtures/autoload/health/full_render.vim deleted file mode 100644 index 2064b8606e..0000000000 --- a/test/functional/fixtures/autoload/health/full_render.vim +++ /dev/null @@ -1,8 +0,0 @@ -function! health#full_render#check() - call health#report_start("report 1") - call health#report_ok("life is fine") - call health#report_warn("no what installed", ["pip what", "make what"]) - call health#report_start("report 2") - call health#report_info("stuff is stable") - call health#report_error("why no hardcopy", [":h :hardcopy", ":h :TOhtml"]) -endfunction diff --git a/test/functional/fixtures/autoload/health/success1.vim b/test/functional/fixtures/autoload/health/success1.vim deleted file mode 100644 index a360347455..0000000000 --- a/test/functional/fixtures/autoload/health/success1.vim +++ /dev/null @@ -1,6 +0,0 @@ -function! health#success1#check() - call health#report_start("report 1") - call health#report_ok("everything is fine") - call health#report_start("report 2") - call health#report_ok("nothing to see here") -endfunction diff --git a/test/functional/fixtures/autoload/health/success2.vim b/test/functional/fixtures/autoload/health/success2.vim deleted file mode 100644 index b742b4879d..0000000000 --- a/test/functional/fixtures/autoload/health/success2.vim +++ /dev/null @@ -1,4 +0,0 @@ -function! health#success2#check() - call health#report_start("another 1") - call health#report_ok("ok") -endfunction diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua index aa47198f7a..0db9265a29 100644 --- a/test/functional/fixtures/fake-lsp-server.lua +++ b/test/functional/fixtures/fake-lsp-server.lua @@ -272,6 +272,7 @@ function tests.text_document_save_did_open() end; body = function() notify('start') + expect_notification('textDocument/didClose') expect_notification('textDocument/didOpen') expect_notification('textDocument/didSave') notify('shutdown') @@ -787,6 +788,9 @@ function tests.code_action_server_side_command() codeActionProvider = { resolveProvider = false, }, + executeCommandProvider = { + commands = {"dummy1"} + }, }, } end, @@ -830,21 +834,21 @@ function tests.code_action_filter() isPreferred = true, command = 'preferred_command', } - local quickfix_action = { + local type_annotate_action = { title = 'Action 3', - kind = 'quickfix', - command = 'quickfix_command', + kind = 'type-annotate', + command = 'type_annotate_command', } - local quickfix_foo_action = { + local type_annotate_foo_action = { title = 'Action 4', - kind = 'quickfix.foo', - command = 'quickfix_foo_command', + kind = 'type-annotate.foo', + command = 'type_annotate_foo_command', } expect_request('textDocument/codeAction', function() - return nil, { action, preferred_action, quickfix_action, quickfix_foo_action, } + return nil, { action, preferred_action, type_annotate_action, type_annotate_foo_action, } end) expect_request('textDocument/codeAction', function() - return nil, { action, preferred_action, quickfix_action, quickfix_foo_action, } + return nil, { action, preferred_action, type_annotate_action, type_annotate_foo_action, } end) notify('shutdown') end; @@ -927,10 +931,53 @@ function tests.basic_formatting() } end --- Tests will be indexed by TEST_NAME +function tests.set_defaults_all_capabilities() + skeleton { + on_init = function(_) + return { + capabilities = { + definitionProvider = true, + completionProvider = true, + documentRangeFormattingProvider = true, + hoverProvider = true, + } + } + end; + body = function() + notify('test') + end; + } +end + +function tests.inlay_hint() + skeleton { + on_init = function(params) + local expected_capabilities = protocol.make_client_capabilities() + assert_eq(params.capabilities, expected_capabilities) + return { + capabilities = { + inlayHintProvider = true; + } + } + end; + body = function() + notify('start') + expect_request('textDocument/inlayHint', function() + return nil, {} + end) + expect_notification("finish") + notify('finish') + end; + } +end + +-- Tests will be indexed by test_name +local test_name = arg[1] +local timeout = arg[2] +assert(type(test_name) == 'string', 'test_name must be specified as first arg.') -local kill_timer = vim.loop.new_timer() -kill_timer:start(_G.TIMEOUT or 1e3, 0, function() +local kill_timer = vim.uv.new_timer() +kill_timer:start(timeout or 1e3, 0, function() kill_timer:stop() kill_timer:close() log('ERROR', 'LSP', 'TIMEOUT') @@ -938,14 +985,11 @@ kill_timer:start(_G.TIMEOUT or 1e3, 0, function() os.exit(100) end) -local test_name = _G.TEST_NAME -- lualint workaround -assert(type(test_name) == 'string', 'TEST_NAME must be specified.') local status, err = pcall(assert(tests[test_name], "Test not found")) kill_timer:stop() kill_timer:close() if not status then log('ERROR', 'LSP', tostring(err)) io.stderr:write(err) - os.exit(101) + vim.cmd [[101cquit]] end -os.exit(0) diff --git a/test/functional/fixtures/lua/test_plug/autoload/health/test_plug.vim b/test/functional/fixtures/lua/test_plug/autoload/health/test_plug.vim deleted file mode 100644 index de05f56e9e..0000000000 --- a/test/functional/fixtures/lua/test_plug/autoload/health/test_plug.vim +++ /dev/null @@ -1,3 +0,0 @@ -function! health#success1#check() - call health#report_start("If you see this I'm broken") -endfunction diff --git a/test/functional/fixtures/lua/test_plug/full_render/health.lua b/test/functional/fixtures/lua/test_plug/full_render/health.lua new file mode 100644 index 0000000000..10833f6239 --- /dev/null +++ b/test/functional/fixtures/lua/test_plug/full_render/health.lua @@ -0,0 +1,12 @@ +local M = {} + +M.check = function() + vim.health.start('report 1') + vim.health.ok('life is fine') + vim.health.warn('no what installed', { 'pip what', 'make what' }) + vim.health.start('report 2') + vim.health.info('stuff is stable') + vim.health.error('why no hardcopy', { ':h :hardcopy', ':h :TOhtml' }) +end + +return M diff --git a/test/functional/fixtures/lua/test_plug/health/init.lua b/test/functional/fixtures/lua/test_plug/health/init.lua index 58162d4515..ef0c5ae3cd 100644 --- a/test/functional/fixtures/lua/test_plug/health/init.lua +++ b/test/functional/fixtures/lua/test_plug/health/init.lua @@ -1,10 +1,10 @@ local M = {} M.check = function() - vim.health.report_start("report 1") - vim.health.report_ok("everything is fine") - vim.health.report_start("report 2") - vim.health.report_ok("nothing to see here") + vim.health.start('report 1') + vim.health.ok('everything is fine') + vim.health.start('report 2') + vim.health.ok('nothing to see here') end return M diff --git a/test/functional/fixtures/lua/test_plug/submodule/health.lua b/test/functional/fixtures/lua/test_plug/submodule/health.lua index 58162d4515..ef0c5ae3cd 100644 --- a/test/functional/fixtures/lua/test_plug/submodule/health.lua +++ b/test/functional/fixtures/lua/test_plug/submodule/health.lua @@ -1,10 +1,10 @@ local M = {} M.check = function() - vim.health.report_start("report 1") - vim.health.report_ok("everything is fine") - vim.health.report_start("report 2") - vim.health.report_ok("nothing to see here") + vim.health.start('report 1') + vim.health.ok('everything is fine') + vim.health.start('report 2') + vim.health.ok('nothing to see here') end return M diff --git a/test/functional/fixtures/lua/test_plug/submodule_failed/health.lua b/test/functional/fixtures/lua/test_plug/submodule_failed/health.lua deleted file mode 100644 index ee5f4e404b..0000000000 --- a/test/functional/fixtures/lua/test_plug/submodule_failed/health.lua +++ /dev/null @@ -1,11 +0,0 @@ -local M = {} - -M.check = function() - vim.health.report_start("report 1") - vim.health.report_ok("everything is fine") - vim.health.report_warn("About to add a number to nil") - local a = nil + 2 - return a -end - -return M diff --git a/test/functional/fixtures/lua/test_plug/success1/health.lua b/test/functional/fixtures/lua/test_plug/success1/health.lua new file mode 100644 index 0000000000..ef0c5ae3cd --- /dev/null +++ b/test/functional/fixtures/lua/test_plug/success1/health.lua @@ -0,0 +1,10 @@ +local M = {} + +M.check = function() + vim.health.start('report 1') + vim.health.ok('everything is fine') + vim.health.start('report 2') + vim.health.ok('nothing to see here') +end + +return M diff --git a/test/functional/fixtures/lua/test_plug/success2/health.lua b/test/functional/fixtures/lua/test_plug/success2/health.lua new file mode 100644 index 0000000000..240a2d33de --- /dev/null +++ b/test/functional/fixtures/lua/test_plug/success2/health.lua @@ -0,0 +1,8 @@ +local M = {} + +M.check = function() + vim.health.start('another 1') + vim.health.ok('ok') +end + +return M diff --git a/test/functional/fixtures/printargs-test.c b/test/functional/fixtures/printargs-test.c index be54605817..2c25cf8447 100644 --- a/test/functional/fixtures/printargs-test.c +++ b/test/functional/fixtures/printargs-test.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include <stdio.h> int main(int argc, char **argv) diff --git a/test/functional/fixtures/printenv-test.c b/test/functional/fixtures/printenv-test.c index 295b4f04c3..f826a28db4 100644 --- a/test/functional/fixtures/printenv-test.c +++ b/test/functional/fixtures/printenv-test.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include <stdio.h> #ifdef MSWIN diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c index 4196716799..ef9f23e3f9 100644 --- a/test/functional/fixtures/shell-test.c +++ b/test/functional/fixtures/shell-test.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include <stdio.h> #include <string.h> #include <stdint.h> diff --git a/test/functional/fixtures/start/nvim-leftpad/lua/async_leftpad.lua b/test/functional/fixtures/start/nvim-leftpad/lua/async_leftpad.lua index 45226ce24b..ffbd8a4f83 100644 --- a/test/functional/fixtures/start/nvim-leftpad/lua/async_leftpad.lua +++ b/test/functional/fixtures/start/nvim-leftpad/lua/async_leftpad.lua @@ -1,5 +1,5 @@ return function (val, res) local handle - handle = vim.loop.new_async(function() _G[res] = require'leftpad'(val) handle:close() end) + handle = vim.uv.new_async(function() _G[res] = require'leftpad'(val) handle:close() end) handle:send() end diff --git a/test/functional/fixtures/streams-test.c b/test/functional/fixtures/streams-test.c index be40edfe7e..5a59abb33b 100644 --- a/test/functional/fixtures/streams-test.c +++ b/test/functional/fixtures/streams-test.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - /// Helper program to exit and keep stdout open (like "xclip -i -loops 1"). #include <stdio.h> diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c index 6ee7715021..f94af2fd12 100644 --- a/test/functional/fixtures/tty-test.c +++ b/test/functional/fixtures/tty-test.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -11,8 +8,6 @@ # include <unistd.h> #endif -// -V:STRUCT_CAST:641 -#define STRUCT_CAST(Type, obj) ((Type *)(obj)) #define is_terminal(stream) (uv_guess_handle(fileno(stream)) == UV_TTY) #define BUF_SIZE 0xfff #define CTRL_C 0x03 @@ -108,10 +103,10 @@ static void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf) .len = (size_t)cnt #endif }; - uv_write(&req, STRUCT_CAST(uv_stream_t, &out), &b, 1, NULL); + uv_write(&req, (uv_stream_t *)&out, &b, 1, NULL); uv_run(&write_loop, UV_RUN_DEFAULT); - uv_close(STRUCT_CAST(uv_handle_t, &out), NULL); + uv_close((uv_handle_t *)&out, NULL); uv_run(&write_loop, UV_RUN_DEFAULT); if (uv_loop_close(&write_loop)) { abort(); @@ -181,7 +176,7 @@ int main(int argc, char **argv) #endif uv_tty_set_mode(&tty, UV_TTY_MODE_RAW); tty.data = &interrupted; - uv_read_start(STRUCT_CAST(uv_stream_t, &tty), alloc_cb, read_cb); + uv_read_start((uv_stream_t *)&tty, alloc_cb, read_cb); #ifndef MSWIN struct sigaction sa; sigemptyset(&sa.sa_mask); diff --git a/test/functional/fixtures/wildpum/Xdir/XdirA/XdirB/XfileC b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XdirB/XfileC index e69de29bb2..e69de29bb2 100644 --- a/test/functional/fixtures/wildpum/Xdir/XdirA/XdirB/XfileC +++ b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XdirB/XfileC diff --git a/test/functional/fixtures/wildpum/Xdir/XdirA/XfileB b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XfileB index e69de29bb2..e69de29bb2 100644 --- a/test/functional/fixtures/wildpum/Xdir/XdirA/XfileB +++ b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XfileB diff --git a/test/functional/fixtures/wildpum/Xdir/XfileA b/test/functional/fixtures/wildpum/Xnamedir/XfileA index e69de29bb2..e69de29bb2 100644 --- a/test/functional/fixtures/wildpum/Xdir/XfileA +++ b/test/functional/fixtures/wildpum/Xnamedir/XfileA |