diff options
Diffstat (limited to 'test/functional/fixtures')
20 files changed, 372 insertions, 349 deletions
diff --git a/test/functional/fixtures/CMakeLists.txt b/test/functional/fixtures/CMakeLists.txt index 6e64b1e4dc..150407fe46 100644 --- a/test/functional/fixtures/CMakeLists.txt +++ b/test/functional/fixtures/CMakeLists.txt @@ -5,7 +5,7 @@ endif() if(WIN32) target_compile_definitions(test_lib INTERFACE MSWIN) endif() -target_link_libraries(test_lib INTERFACE nvim) +target_link_libraries(test_lib INTERFACE nvim_bin) add_executable(tty-test EXCLUDE_FROM_ALL tty-test.c) add_executable(shell-test EXCLUDE_FROM_ALL shell-test.c) diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua index 0db9265a29..d9f44da0b4 100644 --- a/test/functional/fixtures/fake-lsp-server.lua +++ b/test/functional/fixtures/fake-lsp-server.lua @@ -1,19 +1,15 @@ local protocol = require 'vim.lsp.protocol' - -- Logs to $NVIM_LOG_FILE. -- -- TODO(justinmk): remove after https://github.com/neovim/neovim/pull/7062 local function log(loglevel, area, msg) - vim.fn.writefile( - {string.format('%s %s: %s', loglevel, area, msg)}, - vim.env.NVIM_LOG_FILE, - 'a') + vim.fn.writefile({ string.format('%s %s: %s', loglevel, area, msg) }, vim.env.NVIM_LOG_FILE, 'a') end local function message_parts(sep, ...) local parts = {} - for i = 1, select("#", ...) do + for i = 1, select('#', ...) do local arg = select(i, ...) if arg ~= nil then table.insert(parts, arg) @@ -26,26 +22,33 @@ end local function assert_eq(a, b, ...) if not vim.deep_equal(a, b) then - error(message_parts(": ", - ..., "assert_eq failed", - string.format("left == %q, right == %q", - table.concat(vim.split(vim.inspect(a), "\n"), ""), - table.concat(vim.split(vim.inspect(b), "\n"), "") + error( + message_parts( + ': ', + ..., + 'assert_eq failed', + string.format( + 'left == %q, right == %q', + table.concat(vim.split(vim.inspect(a), '\n'), ''), + table.concat(vim.split(vim.inspect(b), '\n'), '') + ) ) - )) + ) end end local function format_message_with_content_length(encoded_message) return table.concat { - 'Content-Length: '; tostring(#encoded_message); '\r\n\r\n'; - encoded_message; + 'Content-Length: ', + tostring(#encoded_message), + '\r\n\r\n', + encoded_message, } end local function read_message() - local line = io.read("*l") - local length = line:lower():match("content%-length:%s*(%d+)") + local line = io.read('*l') + local length = line:lower():match('content%-length:%s*(%d+)') return vim.json.decode(io.read(2 + length):sub(2)) end @@ -54,49 +57,51 @@ local function send(payload) end local function respond(id, err, result) - assert(type(id) == 'number', "id must be a number") - send { jsonrpc = "2.0"; id = id, error = err, result = result } + assert(type(id) == 'number', 'id must be a number') + send { jsonrpc = '2.0', id = id, error = err, result = result } end local function notify(method, params) - assert(type(method) == 'string', "method must be a string") + assert(type(method) == 'string', 'method must be a string') send { method = method, params = params or {} } end local function expect_notification(method, params, ...) local message = read_message() - assert_eq(method, message.method, - ..., "expect_notification", "method") + assert_eq(method, message.method, ..., 'expect_notification', 'method') if params then - assert_eq(params, message.params, - ..., "expect_notification", method, "params") - assert_eq({jsonrpc = "2.0"; method=method, params=params}, message, - ..., "expect_notification", "message") + assert_eq(params, message.params, ..., 'expect_notification', method, 'params') + assert_eq( + { jsonrpc = '2.0', method = method, params = params }, + message, + ..., + 'expect_notification', + 'message' + ) end end local function expect_request(method, handler, ...) local req = read_message() - assert_eq(method, req.method, - ..., "expect_request", "method") + assert_eq(method, req.method, ..., 'expect_request', 'method') local err, result = handler(req.params) respond(req.id, err, result) end -io.stderr:setvbuf("no") +io.stderr:setvbuf('no') local function skeleton(config) local on_init = assert(config.on_init) local body = assert(config.body) - expect_request("initialize", function(params) + expect_request('initialize', function(params) return nil, on_init(params) end) - expect_notification("initialized", {}) + expect_notification('initialized', {}) body() - expect_request("shutdown", function() + expect_request('shutdown', function() return nil, {} end) - expect_notification("exit", nil) + expect_notification('exit', nil) end -- The actual tests. @@ -108,13 +113,13 @@ function tests.basic_init() on_init = function(_) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.None; - } + textDocumentSync = protocol.TextDocumentSyncKind.None, + }, } - end; + end, body = function() notify('test') - end; + end, } end @@ -135,89 +140,95 @@ function tests.check_workspace_configuration() skeleton { on_init = function(_params) return { capabilities = {} } - end; + end, body = function() notify('start') - notify('workspace/configuration', { items = { - { section = "testSetting1" }; - { section = "testSetting2" }; - { section = "test.Setting3" }; - { section = "test.Setting4" }; - } }) - expect_notification('workspace/configuration', { true; false; 'nested'; vim.NIL}) + notify('workspace/configuration', { + items = { + { section = 'testSetting1' }, + { section = 'testSetting2' }, + { section = 'test.Setting3' }, + { section = 'test.Setting4' }, + }, + }) + expect_notification('workspace/configuration', { true, false, 'nested', vim.NIL }) notify('shutdown') - end; + end, } end function tests.prepare_rename_nil() skeleton { on_init = function() - return { capabilities = { - renameProvider = { - prepareProvider = true - } - } + return { + capabilities = { + renameProvider = { + prepareProvider = true, + }, + }, } - end; + end, body = function() notify('start') expect_request('textDocument/prepareRename', function() return nil, nil end) notify('shutdown') - end; + end, } end function tests.prepare_rename_placeholder() skeleton { on_init = function() - return { capabilities = { - renameProvider = { - prepareProvider = true - } - } + return { + capabilities = { + renameProvider = { + prepareProvider = true, + }, + }, } - end; + end, body = function() notify('start') expect_request('textDocument/prepareRename', function() - return nil, {placeholder = 'placeholder'} + return nil, { placeholder = 'placeholder' } end) expect_request('textDocument/rename', function(params) assert_eq(params.newName, 'renameto') return nil, nil end) notify('shutdown') - end; + end, } end function tests.prepare_rename_range() skeleton { on_init = function() - return { capabilities = { - renameProvider = { - prepareProvider = true - } - } + return { + capabilities = { + renameProvider = { + prepareProvider = true, + }, + }, } - end; + end, body = function() notify('start') expect_request('textDocument/prepareRename', function() - return nil, { - start = { line = 1, character = 8 }, - ['end'] = { line = 1, character = 12 }, - } + return nil, + { + start = { line = 1, character = 8 }, + ['end'] = { line = 1, character = 12 }, + } end) expect_request('textDocument/rename', function(params) assert_eq(params.newName, 'renameto') return nil, nil end) notify('shutdown') - end; + end, } end @@ -227,18 +238,18 @@ function tests.prepare_rename_error() return { capabilities = { renameProvider = { - prepareProvider = true + prepareProvider = true, }, - } + }, } - end; + end, body = function() notify('start') expect_request('textDocument/prepareRename', function() return {}, nil end) notify('shutdown') - end; + end, } end @@ -249,13 +260,12 @@ function tests.basic_check_capabilities() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - codeLensProvider = false - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + codeLensProvider = false, + }, } - end; - body = function() - end; + end, + body = function() end, } end @@ -265,18 +275,18 @@ function tests.text_document_save_did_open() return { capabilities = { textDocumentSync = { - save = true - } - } + save = true, + }, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didClose') expect_notification('textDocument/didOpen') expect_notification('textDocument/didSave') notify('shutdown') - end; + end, } end @@ -286,16 +296,16 @@ function tests.text_document_sync_save_bool() return { capabilities = { textDocumentSync = { - save = true - } - } + save = true, + }, + }, } - end; + end, body = function() notify('start') - expect_notification('textDocument/didSave', {textDocument = { uri = "file://" }}) + expect_notification('textDocument/didSave', { textDocument = { uri = 'file://' } }) notify('shutdown') - end; + end, } end @@ -306,22 +316,22 @@ function tests.text_document_sync_save_includeText() capabilities = { textDocumentSync = { save = { - includeText = true - } - } - } + includeText = true, + }, + }, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didSave', { textDocument = { - uri = "file://" + uri = 'file://', }, - text = "help me\n" + text = 'help me\n', }) notify('shutdown') - end; + end, } end @@ -332,18 +342,17 @@ function tests.capabilities_for_client_supports_method() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - completionProvider = true; - hoverProvider = true; - renameProvider = false; - definitionProvider = false; - referencesProvider = false; - codeLensProvider = { resolveProvider = true; }; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + completionProvider = true, + hoverProvider = true, + renameProvider = false, + definitionProvider = false, + referencesProvider = false, + codeLensProvider = { resolveProvider = true }, + }, } - end; - body = function() - end; + end, + body = function() end, } end @@ -351,13 +360,13 @@ function tests.check_forward_request_cancelled() skeleton { on_init = function(_) return { capabilities = {} } - end; + end, body = function() - expect_request("error_code_test", function() - return {code = -32800}, nil, {method = "error_code_test", client_id=1} + expect_request('error_code_test', function() + return { code = -32800 }, nil, { method = 'error_code_test', client_id = 1 } end) notify('finish') - end; + end, } end @@ -365,14 +374,14 @@ function tests.check_forward_content_modified() skeleton { on_init = function(_) return { capabilities = {} } - end; + end, body = function() - expect_request("error_code_test", function() - return {code = -32801}, nil, {method = "error_code_test", client_id=1} + expect_request('error_code_test', function() + return { code = -32801 }, nil, { method = 'error_code_test', client_id = 1 } end) expect_notification('finish') notify('finish') - end; + end, } end @@ -380,15 +389,15 @@ function tests.check_pending_request_tracked() skeleton { on_init = function(_) return { capabilities = {} } - end; + end, body = function() - local msg = read_message() - assert_eq('slow_request', msg.method) - expect_notification('release') - respond(msg.id, nil, {}) - expect_notification('finish') - notify('finish') - end; + local msg = read_message() + assert_eq('slow_request', msg.method) + expect_notification('release') + respond(msg.id, nil, {}) + expect_notification('finish') + notify('finish') + end, } end @@ -396,15 +405,15 @@ function tests.check_cancel_request_tracked() skeleton { on_init = function(_) return { capabilities = {} } - end; + end, body = function() - local msg = read_message() - assert_eq('slow_request', msg.method) - expect_notification('$/cancelRequest', {id=msg.id}) - expect_notification('release') - respond(msg.id, {code = -32800}, nil) - notify('finish') - end; + local msg = read_message() + assert_eq('slow_request', msg.method) + expect_notification('$/cancelRequest', { id = msg.id }) + expect_notification('release') + respond(msg.id, { code = -32800 }, nil) + notify('finish') + end, } end @@ -412,16 +421,16 @@ function tests.check_tracked_requests_cleared() skeleton { on_init = function(_) return { capabilities = {} } - end; + end, body = function() - local msg = read_message() - assert_eq('slow_request', msg.method) - expect_notification('$/cancelRequest', {id=msg.id}) - expect_notification('release') - respond(msg.id, nil, {}) - expect_notification('finish') - notify('finish') - end; + local msg = read_message() + assert_eq('slow_request', msg.method) + expect_notification('$/cancelRequest', { id = msg.id }) + expect_notification('release') + respond(msg.id, nil, {}) + expect_notification('finish') + notify('finish') + end, } end @@ -432,14 +441,14 @@ function tests.basic_finish() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + }, } - end; + end, body = function() - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -450,23 +459,23 @@ function tests.basic_check_buffer_open() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n') .. '\n', + uri = 'file://', + version = 0, + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -477,32 +486,32 @@ function tests.basic_check_buffer_open_and_change() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n') .. '\n', + uri = 'file://', + version = 0, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 3; - }; + uri = 'file://', + version = 3, + }, contentChanges = { - { text = table.concat({"testing"; "boop"}, "\n") .. '\n'; }; - } + { text = table.concat({ 'testing', 'boop' }, '\n') .. '\n' }, + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -513,32 +522,32 @@ function tests.basic_check_buffer_open_and_change_noeol() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n"); - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n'), + uri = 'file://', + version = 0, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 3; - }; + uri = 'file://', + version = 3, + }, contentChanges = { - { text = table.concat({"testing"; "boop"}, "\n"); }; - } + { text = table.concat({ 'testing', 'boop' }, '\n') }, + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end function tests.basic_check_buffer_open_and_change_multi() @@ -548,41 +557,41 @@ function tests.basic_check_buffer_open_and_change_multi() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n') .. '\n', + uri = 'file://', + version = 0, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 3; - }; + uri = 'file://', + version = 3, + }, contentChanges = { - { text = table.concat({"testing"; "321"}, "\n") .. '\n'; }; - } + { text = table.concat({ 'testing', '321' }, '\n') .. '\n' }, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 4; - }; + uri = 'file://', + version = 4, + }, contentChanges = { - { text = table.concat({"testing"; "boop"}, "\n") .. '\n'; }; - } + { text = table.concat({ 'testing', 'boop' }, '\n') .. '\n' }, + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -593,46 +602,46 @@ function tests.basic_check_buffer_open_and_change_multi_and_close() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Full; - } + textDocumentSync = protocol.TextDocumentSyncKind.Full, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n') .. '\n', + uri = 'file://', + version = 0, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 3; - }; + uri = 'file://', + version = 3, + }, contentChanges = { - { text = table.concat({"testing"; "321"}, "\n") .. '\n'; }; - } + { text = table.concat({ 'testing', '321' }, '\n') .. '\n' }, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 4; - }; + uri = 'file://', + version = 4, + }, contentChanges = { - { text = table.concat({"testing"; "boop"}, "\n") .. '\n'; }; - } + { text = table.concat({ 'testing', 'boop' }, '\n') .. '\n' }, + }, }) expect_notification('textDocument/didClose', { textDocument = { - uri = "file://"; - }; + uri = 'file://', + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -650,40 +659,40 @@ function tests.basic_check_buffer_open_and_change_incremental() willSaveWaitUntil = true, save = { includeText = true, - } - } - } + }, + }, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n') .. '\n', + uri = 'file://', + version = 0, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 3; - }; + uri = 'file://', + version = 3, + }, contentChanges = { { range = { - start = { line = 1; character = 3; }; - ["end"] = { line = 1; character = 3; }; - }; - rangeLength = 0; - text = "boop"; - }; - } + start = { line = 1, character = 3 }, + ['end'] = { line = 1, character = 3 }, + }, + rangeLength = 0, + text = 'boop', + }, + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -694,89 +703,88 @@ function tests.basic_check_buffer_open_and_change_incremental_editing() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - textDocumentSync = protocol.TextDocumentSyncKind.Incremental; - } + textDocumentSync = protocol.TextDocumentSyncKind.Incremental, + }, } - end; + end, body = function() notify('start') expect_notification('textDocument/didOpen', { textDocument = { - languageId = ""; - text = table.concat({"testing"; "123"}, "\n"); - uri = "file://"; - version = 0; - }; + languageId = '', + text = table.concat({ 'testing', '123' }, '\n'), + uri = 'file://', + version = 0, + }, }) expect_notification('textDocument/didChange', { textDocument = { - uri = "file://"; - version = 3; - }; + uri = 'file://', + version = 3, + }, contentChanges = { { range = { - start = { line = 0; character = 0; }; - ["end"] = { line = 1; character = 0; }; - }; - rangeLength = 4; - text = "testing\n\n"; - }; - } + start = { line = 0, character = 0 }, + ['end'] = { line = 1, character = 0 }, + }, + rangeLength = 4, + text = 'testing\n\n', + }, + }, }) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end function tests.invalid_header() - io.stdout:write("Content-length: \r\n") + io.stdout:write('Content-length: \r\n') end function tests.decode_nil() skeleton { on_init = function(_) return { capabilities = {} } - end; + end, body = function() notify('start') - notify("workspace/executeCommand", { - arguments = { "EXTRACT_METHOD", {metadata = {field = vim.NIL}}, 3, 0, 6123, vim.NIL }, - command = "refactor.perform", - title = "EXTRACT_METHOD" + notify('workspace/executeCommand', { + arguments = { 'EXTRACT_METHOD', { metadata = { field = vim.NIL } }, 3, 0, 6123, vim.NIL }, + command = 'refactor.perform', + title = 'EXTRACT_METHOD', }) notify('finish') - end; + end, } end - function tests.code_action_with_resolve() skeleton { on_init = function() return { capabilities = { codeActionProvider = { - resolveProvider = true - } - } + resolveProvider = true, + }, + }, } - end; + end, body = function() notify('start') local cmd = { title = 'Command 1', - command = 'dummy1' + command = 'dummy1', } expect_request('textDocument/codeAction', function() - return nil, { cmd, } + return nil, { cmd } end) expect_request('codeAction/resolve', function() return nil, cmd end) notify('shutdown') - end; + end, } end @@ -789,7 +797,7 @@ function tests.code_action_server_side_command() resolveProvider = false, }, executeCommandProvider = { - commands = {"dummy1"} + commands = { 'dummy1' }, }, }, } @@ -811,23 +819,22 @@ function tests.code_action_server_side_command() }) end - function tests.code_action_filter() skeleton { on_init = function() return { capabilities = { codeActionProvider = { - resolveProvider = false - } - } + resolveProvider = false, + }, + }, } - end; + end, body = function() notify('start') local action = { title = 'Action 1', - command = 'command' + command = 'command', } local preferred_action = { title = 'Action 2', @@ -845,13 +852,13 @@ function tests.code_action_filter() command = 'type_annotate_foo_command', } expect_request('textDocument/codeAction', function() - return nil, { action, preferred_action, type_annotate_action, type_annotate_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, type_annotate_action, type_annotate_foo_action, } + return nil, { action, preferred_action, type_annotate_action, type_annotate_foo_action } end) notify('shutdown') - end; + end, } end @@ -859,13 +866,13 @@ function tests.clientside_commands() skeleton { on_init = function() return { - capabilities = {} + capabilities = {}, } - end; + end, body = function() notify('start') notify('shutdown') - end; + end, } end @@ -874,41 +881,41 @@ function tests.codelens_refresh_lock() on_init = function() return { capabilities = { - codeLensProvider = { resolveProvider = true; }; - } + codeLensProvider = { resolveProvider = true }, + }, } - end; + end, body = function() notify('start') - expect_request("textDocument/codeLens", function () - return {code = -32002, message = "ServerNotInitialized"}, nil + expect_request('textDocument/codeLens', function() + return { code = -32002, message = 'ServerNotInitialized' }, nil end) - expect_request("textDocument/codeLens", function () + expect_request('textDocument/codeLens', function() local lenses = { { range = { - start = { line = 0, character = 0, }, - ['end'] = { line = 0, character = 3 } + start = { line = 0, character = 0 }, + ['end'] = { line = 0, character = 3 }, }, - command = { title = 'Lens1', command = 'Dummy' } + command = { title = 'Lens1', command = 'Dummy' }, }, } return nil, lenses end) - expect_request("textDocument/codeLens", function () + expect_request('textDocument/codeLens', function() local lenses = { { range = { - start = { line = 0, character = 0, }, - ['end'] = { line = 0, character = 3 } + start = { line = 0, character = 0 }, + ['end'] = { line = 0, character = 3 }, }, - command = { title = 'Lens2', command = 'Dummy' } + command = { title = 'Lens2', command = 'Dummy' }, }, } return nil, lenses end) notify('shutdown') - end; + end, } end @@ -918,16 +925,16 @@ function tests.basic_formatting() return { capabilities = { documentFormattingProvider = true, - } + }, } - end; + end, body = function() notify('start') expect_request('textDocument/formatting', function() return nil, {} end) notify('shutdown') - end; + end, } end @@ -940,12 +947,12 @@ function tests.set_defaults_all_capabilities() completionProvider = true, documentRangeFormattingProvider = true, hoverProvider = true, - } + }, } - end; + end, body = function() notify('test') - end; + end, } end @@ -956,18 +963,18 @@ function tests.inlay_hint() assert_eq(params.capabilities, expected_capabilities) return { capabilities = { - inlayHintProvider = true; - } + inlayHintProvider = true, + }, } - end; + end, body = function() notify('start') expect_request('textDocument/inlayHint', function() return nil, {} end) - expect_notification("finish") + expect_notification('finish') notify('finish') - end; + end, } end @@ -981,11 +988,11 @@ kill_timer:start(timeout or 1e3, 0, function() kill_timer:stop() kill_timer:close() log('ERROR', 'LSP', 'TIMEOUT') - io.stderr:write("TIMEOUT") + io.stderr:write('TIMEOUT') os.exit(100) end) -local status, err = pcall(assert(tests[test_name], "Test not found")) +local status, err = pcall(assert(tests[test_name], 'Test not found')) kill_timer:stop() kill_timer:close() if not status then diff --git a/test/functional/fixtures/middle/filen.lua b/test/functional/fixtures/middle/filen.lua index fce50cc776..24ccb200de 100644 --- a/test/functional/fixtures/middle/filen.lua +++ b/test/functional/fixtures/middle/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "mittel") +table.insert(_G.test_loadorder, 'mittel') diff --git a/test/functional/fixtures/nvim/after/filen.lua b/test/functional/fixtures/nvim/after/filen.lua index 0128a0a16a..13f0cfc6b9 100644 --- a/test/functional/fixtures/nvim/after/filen.lua +++ b/test/functional/fixtures/nvim/after/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "ordinary after") +table.insert(_G.test_loadorder, 'ordinary after') diff --git a/test/functional/fixtures/nvim/filen.lua b/test/functional/fixtures/nvim/filen.lua index e2bd5e8f7f..914e551c96 100644 --- a/test/functional/fixtures/nvim/filen.lua +++ b/test/functional/fixtures/nvim/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "ordinary") +table.insert(_G.test_loadorder, 'ordinary') diff --git a/test/functional/fixtures/pack/foo/opt/bonus/lua/bonus.lua b/test/functional/fixtures/pack/foo/opt/bonus/lua/bonus.lua index 52cb0bc118..2ceec737fd 100644 --- a/test/functional/fixtures/pack/foo/opt/bonus/lua/bonus.lua +++ b/test/functional/fixtures/pack/foo/opt/bonus/lua/bonus.lua @@ -1 +1,5 @@ -return {launch=function() return "CPE 1704 TKS" end} +return { + launch = function() + return 'CPE 1704 TKS' + end, +} diff --git a/test/functional/fixtures/pack/foo/opt/funky/filen.lua b/test/functional/fixtures/pack/foo/opt/funky/filen.lua index a33b83c2a7..de0a754f6c 100644 --- a/test/functional/fixtures/pack/foo/opt/funky/filen.lua +++ b/test/functional/fixtures/pack/foo/opt/funky/filen.lua @@ -1,10 +1,10 @@ -table.insert(_G.test_loadorder, "funky!") +table.insert(_G.test_loadorder, 'funky!') if not _G.nesty then _G.nesty = true local save_order = _G.test_loadorder _G.test_loadorder = {} - _G.vim.o.pp = "" -- funky! + _G.vim.o.pp = '' -- funky! vim.cmd [[runtime! filen.lua ]] _G.nested_order = _G.test_loadorder _G.test_loadorder = save_order diff --git a/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua b/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua index 94bf6850b2..c906250fc9 100644 --- a/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua +++ b/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "SuperSpecial after") +table.insert(_G.test_loadorder, 'SuperSpecial after') diff --git a/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua b/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua index cbaab1a45a..0dcd7f90d5 100644 --- a/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua +++ b/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "SuperSpecial") +table.insert(_G.test_loadorder, 'SuperSpecial') diff --git a/test/functional/fixtures/pack/foo/start/bar/lua/bar.lua b/test/functional/fixtures/pack/foo/start/bar/lua/bar.lua index a7e9a61e35..1413376e02 100644 --- a/test/functional/fixtures/pack/foo/start/bar/lua/bar.lua +++ b/test/functional/fixtures/pack/foo/start/bar/lua/bar.lua @@ -1 +1,5 @@ -return {doit=function() return 9003 end} +return { + doit = function() + return 9003 + end, +} diff --git a/test/functional/fixtures/pack/foo/start/bar/lua/baz-quux.lua b/test/functional/fixtures/pack/foo/start/bar/lua/baz-quux.lua index c1c33d787e..c4677adcaf 100644 --- a/test/functional/fixtures/pack/foo/start/bar/lua/baz-quux.lua +++ b/test/functional/fixtures/pack/foo/start/bar/lua/baz-quux.lua @@ -1 +1,5 @@ -return {doit=function() return 9004 end} +return { + doit = function() + return 9004 + end, +} diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua index 9beac762ee..bfd837d703 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "FANCY after") +table.insert(_G.test_loadorder, 'FANCY after') diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_y.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_y.lua index 7daa7733a0..a11d74597c 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_y.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_y.lua @@ -1 +1 @@ -return "I am fancy_y.lua" +return 'I am fancy_y.lua' diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_z.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_z.lua index 6e81afdd70..f360731c79 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_z.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/after/lua/fancy_z.lua @@ -1 +1 @@ -return "I am fancy_z.lua" +return 'I am fancy_z.lua' diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua index 34e4b9c95e..b354c5d8cd 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua @@ -1 +1 @@ -table.insert(_G.test_loadorder, "FANCY") +table.insert(_G.test_loadorder, 'FANCY') diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x.lua index 1b897a96cc..d96270f01e 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x.lua @@ -1 +1 @@ -return "I am fancy_x.lua" +return 'I am fancy_x.lua' diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x/init.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x/init.lua index 8c27a43cab..83874e194c 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x/init.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_x/init.lua @@ -1 +1 @@ -return "I am init.lua of fancy_x!" +return 'I am init.lua of fancy_x!' diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_y/init.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_y/init.lua index b66cbee4f6..a2dd2a9df0 100644 --- a/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_y/init.lua +++ b/test/functional/fixtures/pack/foo/start/fancyplugin/lua/fancy_y/init.lua @@ -1,2 +1 @@ - -return "I am init.lua of fancy_y!" +return 'I am init.lua of fancy_y!' 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 ffbd8a4f83..ee116d761a 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,8 @@ -return function (val, res) +return function(val, res) local handle - handle = vim.uv.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/start/nvim-leftpad/lua/leftpad.lua b/test/functional/fixtures/start/nvim-leftpad/lua/leftpad.lua index 866ed2fd30..5deb505624 100644 --- a/test/functional/fixtures/start/nvim-leftpad/lua/leftpad.lua +++ b/test/functional/fixtures/start/nvim-leftpad/lua/leftpad.lua @@ -1 +1,3 @@ -return function (str) return '\t' .. str end +return function(str) + return '\t' .. str +end |