diff options
Diffstat (limited to 'test/functional/plugin')
22 files changed, 163 insertions, 131 deletions
diff --git a/test/functional/plugin/ccomplete_spec.lua b/test/functional/plugin/ccomplete_spec.lua index bb9b28d300..4c4c5e9444 100644 --- a/test/functional/plugin/ccomplete_spec.lua +++ b/test/functional/plugin/ccomplete_spec.lua @@ -1,9 +1,11 @@ -local t = require('test.functional.testutil')() -local clear = t.clear -local command = t.command +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear +local command = n.command local eq = t.eq -local eval = t.eval -local feed = t.feed +local eval = n.eval +local feed = n.feed local write_file = t.write_file describe('ccomplete#Complete', function() diff --git a/test/functional/plugin/cfilter_spec.lua b/test/functional/plugin/cfilter_spec.lua index d421c5fc14..220404a934 100644 --- a/test/functional/plugin/cfilter_spec.lua +++ b/test/functional/plugin/cfilter_spec.lua @@ -1,8 +1,10 @@ -local t = require('test.functional.testutil')() -local clear = t.clear -local command = t.command +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear +local command = n.command local eq = t.eq -local fn = t.fn +local fn = n.fn describe('cfilter.lua', function() before_each(function() diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua index d108f325e1..839a723405 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() -local clear = t.clear -local command = t.command +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear +local command = n.command local eq = t.eq -local pathsep = t.get_pathsep() -local fn = t.fn -local api = t.api -local exec_lua = t.exec_lua +local pathsep = n.get_pathsep() +local fn = n.fn +local api = n.api +local exec_lua = n.exec_lua local testdir = 'Xtest-editorconfig' @@ -20,7 +22,7 @@ local function test_case(name, expected) end setup(function() - t.mkdir_p(testdir) + n.mkdir_p(testdir) t.write_file( testdir .. pathsep .. '.editorconfig', [[ @@ -96,7 +98,7 @@ setup(function() end) teardown(function() - t.rmdir(testdir) + n.rmdir(testdir) end) describe('editorconfig', function() diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 9c17e74e19..78cffd07fb 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -1,17 +1,18 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local clear = t.clear -local curbuf_contents = t.curbuf_contents -local command = t.command +local clear = n.clear +local curbuf_contents = n.curbuf_contents +local command = n.command local eq, neq, matches = t.eq, t.neq, t.matches -local getcompletion = t.fn.getcompletion -local exec_lua = t.exec_lua -local assert_alive = t.assert_alive -local insert = t.insert -local source = t.source -local fn = t.fn -local api = t.api +local getcompletion = n.fn.getcompletion +local insert = n.insert +local exec_lua = n.exec_lua +local source = n.source +local assert_alive = n.assert_alive +local fn = n.fn +local api = n.api describe(':checkhealth', function() it('detects invalid $VIMRUNTIME', function() @@ -67,7 +68,7 @@ describe('health.vim', function() describe(':checkhealth', function() it('functions report_*() render correctly', function() command('checkhealth full_render') - t.expect([[ + n.expect([[ ============================================================================== test_plug.full_render: require("test_plug.full_render.health").check() @@ -90,7 +91,7 @@ describe('health.vim', function() it('concatenates multiple reports', function() command('checkhealth success1 success2 test_plug') - t.expect([[ + n.expect([[ ============================================================================== test_plug: require("test_plug.health").check() @@ -120,7 +121,7 @@ describe('health.vim', function() it('lua plugins submodules', function() command('checkhealth test_plug.submodule') - t.expect([[ + n.expect([[ ============================================================================== test_plug.submodule: require("test_plug.submodule.health").check() @@ -135,7 +136,7 @@ describe('health.vim', function() it('... including empty reports', function() command('checkhealth test_plug.submodule_empty') - t.expect([[ + n.expect([[ ============================================================================== test_plug.submodule_empty: require("test_plug.submodule_empty.health").check() @@ -176,7 +177,7 @@ describe('health.vim', function() it('gracefully handles invalid healthcheck', function() command('checkhealth non_existent_healthcheck') -- luacheck: ignore 613 - t.expect([[ + n.expect([[ ============================================================================== non_existent_healthcheck: @@ -188,7 +189,7 @@ describe('health.vim', function() it('does not use vim.health as a healtcheck', function() -- vim.health is not a healthcheck command('checkhealth vim') - t.expect([[ + n.expect([[ ERROR: No healthchecks found.]]) end) end) diff --git a/test/functional/plugin/lsp/codelens_spec.lua b/test/functional/plugin/lsp/codelens_spec.lua index 20e850eeee..cd20e95dd1 100644 --- a/test/functional/plugin/lsp/codelens_spec.lua +++ b/test/functional/plugin/lsp/codelens_spec.lua @@ -1,14 +1,15 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local exec_lua = t.exec_lua +local exec_lua = n.exec_lua local eq = t.eq describe('vim.lsp.codelens', function() before_each(function() - t.clear() + n.clear() exec_lua('require("vim.lsp")') end) - after_each(t.clear) + after_each(n.clear) it('on_codelens_stores_and_displays_lenses', function() local fake_uri = 'file:///fake/uri' diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index 18f123a979..2798d57381 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -1,7 +1,9 @@ ---@diagnostic disable: no-unknown -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local eq = t.eq -local exec_lua = t.exec_lua +local exec_lua = n.exec_lua --- Convert completion results. --- @@ -41,7 +43,7 @@ local function complete(line, candidates, lnum) end describe('vim.lsp._completion', function() - before_each(t.clear) + before_each(n.clear) -- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion it('prefers textEdit over label as word', function() diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua index 27b0da1f3d..c5e14ffdc2 100644 --- a/test/functional/plugin/lsp/diagnostic_spec.lua +++ b/test/functional/plugin/lsp/diagnostic_spec.lua @@ -1,8 +1,10 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local t_lsp = require('test.functional.plugin.lsp.testutil') -local clear = t.clear -local exec_lua = t.exec_lua +local clear = n.clear +local exec_lua = n.exec_lua local eq = t.eq local neq = t.neq diff --git a/test/functional/plugin/lsp/handler_spec.lua b/test/functional/plugin/lsp/handler_spec.lua index 0ce7479c49..013a5fb5e7 100644 --- a/test/functional/plugin/lsp/handler_spec.lua +++ b/test/functional/plugin/lsp/handler_spec.lua @@ -1,7 +1,8 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local exec_lua = t.exec_lua +local exec_lua = n.exec_lua local pcall_err = t.pcall_err local matches = t.matches diff --git a/test/functional/plugin/lsp/incremental_sync_spec.lua b/test/functional/plugin/lsp/incremental_sync_spec.lua index a44b861ca1..238b90b57d 100644 --- a/test/functional/plugin/lsp/incremental_sync_spec.lua +++ b/test/functional/plugin/lsp/incremental_sync_spec.lua @@ -1,11 +1,12 @@ -- Test suite for testing interactions with the incremental sync algorithms powering the LSP client -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local api = t.api -local clear = t.clear +local api = n.api +local clear = n.clear local eq = t.eq -local exec_lua = t.exec_lua -local feed = t.feed +local exec_lua = n.exec_lua +local feed = n.feed before_each(function() clear() diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua index 24c93fcbe0..0aaf94d6da 100644 --- a/test/functional/plugin/lsp/inlay_hint_spec.lua +++ b/test/functional/plugin/lsp/inlay_hint_spec.lua @@ -1,12 +1,13 @@ -local t = require('test.functional.testutil')() -local t_lsp = require('test.functional.plugin.lsp.testutil') +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') +local t_lsp = require('test.functional.plugin.lsp.testutil') local eq = t.eq local dedent = t.dedent -local exec_lua = t.exec_lua -local insert = t.insert -local api = t.api +local exec_lua = n.exec_lua +local insert = n.insert +local api = n.api local clear_notrace = t_lsp.clear_notrace local create_server_definition = t_lsp.create_server_definition diff --git a/test/functional/plugin/lsp/semantic_tokens_spec.lua b/test/functional/plugin/lsp/semantic_tokens_spec.lua index a9d8592eb0..013393095e 100644 --- a/test/functional/plugin/lsp/semantic_tokens_spec.lua +++ b/test/functional/plugin/lsp/semantic_tokens_spec.lua @@ -1,16 +1,17 @@ -local t = require('test.functional.testutil')() -local t_lsp = require('test.functional.plugin.lsp.testutil') +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') +local t_lsp = require('test.functional.plugin.lsp.testutil') -local command = t.command +local command = n.command local dedent = t.dedent local eq = t.eq -local exec_lua = t.exec_lua -local feed = t.feed -local feed_command = t.feed_command -local insert = t.insert +local exec_lua = n.exec_lua +local feed = n.feed +local feed_command = n.feed_command +local insert = n.insert local matches = t.matches -local api = t.api +local api = n.api local clear_notrace = t_lsp.clear_notrace local create_server_definition = t_lsp.create_server_definition diff --git a/test/functional/plugin/lsp/snippet_spec.lua b/test/functional/plugin/lsp/snippet_spec.lua index 0f4304868b..e60c36cd23 100644 --- a/test/functional/plugin/lsp/snippet_spec.lua +++ b/test/functional/plugin/lsp/snippet_spec.lua @@ -1,13 +1,15 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local snippet = require('vim.lsp._snippet_grammar') local type = snippet.NodeType local eq = t.eq -local exec_lua = t.exec_lua +local exec_lua = n.exec_lua describe('vim.lsp._snippet_grammar', function() - before_each(t.clear) - after_each(t.clear) + before_each(n.clear) + after_each(n.clear) local parse = function(...) local res = exec_lua('return require("vim.lsp._snippet_grammar").parse(...)', ...) diff --git a/test/functional/plugin/lsp/testutil.lua b/test/functional/plugin/lsp/testutil.lua index c51ccf3097..4d14752f2a 100644 --- a/test/functional/plugin/lsp/testutil.lua +++ b/test/functional/plugin/lsp/testutil.lua @@ -1,10 +1,10 @@ -local t = require('test.functional.testutil')() +local n = require('test.functional.testnvim')() -local clear = t.clear -local exec_lua = t.exec_lua -local run = t.run -local stop = t.stop -local api = t.api +local clear = n.clear +local exec_lua = n.exec_lua +local run = n.run +local stop = n.stop +local api = n.api local NIL = vim.NIL local M = {} diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index 8e57ace449..6c6dec0667 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -1,12 +1,13 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local feed = t.feed +local feed = n.feed local eq = t.eq -local exec_lua = t.exec_lua +local exec_lua = n.exec_lua describe('vim.lsp.util', function() - before_each(t.clear) + before_each(n.clear) describe('stylize_markdown', function() local stylize_markdown = function(content, opts) @@ -142,7 +143,7 @@ describe('vim.lsp.util', function() local screen before_each(function() - t.clear() + n.clear() screen = Screen.new(80, 80) screen:attach() feed('79i<CR><Esc>') -- fill screen with empty lines diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index d471aadf9c..8d3e141944 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -1,26 +1,28 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local t_lsp = require('test.functional.plugin.lsp.testutil') local assert_log = t.assert_log -local buf_lines = t.buf_lines -local clear = t.clear -local command = t.command +local buf_lines = n.buf_lines +local clear = n.clear +local command = n.command local dedent = t.dedent -local exec_lua = t.exec_lua +local exec_lua = n.exec_lua local eq = t.eq -local eval = t.eval +local eval = n.eval local matches = t.matches local pcall_err = t.pcall_err local pesc = vim.pesc -local insert = t.insert -local fn = t.fn +local insert = n.insert +local fn = n.fn local retry = t.retry -local stop = t.stop +local stop = n.stop local NIL = vim.NIL local read_file = t.read_file local write_file = t.write_file local is_ci = t.is_ci -local api = t.api +local api = n.api local is_os = t.is_os local skip = t.skip local mkdir = t.mkdir @@ -1481,7 +1483,7 @@ describe('LSP', function() end, on_handler = function(err, result, ctx) if ctx.method == 'start' then - t.command('normal! 1Go') + n.command('normal! 1Go') client.notify('finish') end eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler') @@ -2368,7 +2370,7 @@ describe('LSP', function() end) describe('lsp.util.rename', function() - local pathsep = t.get_pathsep() + local pathsep = n.get_pathsep() it('Can rename an existing file', function() local old = tmpname() @@ -2404,7 +2406,7 @@ describe('LSP', function() os.remove(old_dir) os.remove(new_dir) - t.mkdir_p(old_dir) + n.mkdir_p(old_dir) local file = 'file.txt' write_file(old_dir .. pathsep .. file, 'Test content') @@ -2440,7 +2442,7 @@ describe('LSP', function() local new = tmpname() os.remove(old) os.remove(new) - t.mkdir_p(old) + n.mkdir_p(old) local result = exec_lua( [[ diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index 19d279afbf..e9500bf920 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -1,10 +1,12 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local command, feed = t.command, t.feed -local clear = t.clear -local exec_lua = t.exec_lua -local fn = t.fn -local nvim_prog = t.nvim_prog + +local command, feed = n.command, n.feed +local clear = n.clear +local exec_lua = n.exec_lua +local fn = n.fn +local nvim_prog = n.nvim_prog local matches = t.matches local write_file = t.write_file local tmpname = t.tmpname diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua index ae343b9555..ae718ac1bd 100644 --- a/test/functional/plugin/matchparen_spec.lua +++ b/test/functional/plugin/matchparen_spec.lua @@ -1,10 +1,11 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local clear = t.clear -local command = t.command -local api = t.api -local feed = t.feed +local clear = n.clear +local command = n.command +local api = n.api +local feed = n.feed local eq = t.eq describe('matchparen', function() diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua index 9b70c12fc7..1d5d20ec02 100644 --- a/test/functional/plugin/msgpack_spec.lua +++ b/test/functional/plugin/msgpack_spec.lua @@ -1,10 +1,12 @@ -local t = require('test.functional.testutil')() -local clear = t.clear -local api = t.api +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear +local api = n.api local eq = t.eq -local nvim_eval = t.eval -local nvim_command = t.command -local exc_exec = t.exc_exec +local nvim_eval = n.eval +local nvim_command = n.command +local exc_exec = n.exc_exec local ok = t.ok local NIL = vim.NIL diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index 270eacc653..1c2bcbd497 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -1,12 +1,14 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local clear = t.clear +local t_shada = require('test.functional.shada.testutil') + +local clear = n.clear local eq, api, nvim_eval, nvim_command, exc_exec, fn, nvim_feed = - t.eq, t.api, t.eval, t.command, t.exc_exec, t.fn, t.feed + t.eq, n.api, n.eval, n.command, n.exc_exec, n.fn, n.feed local neq = t.neq local read_file = t.read_file -local t_shada = require('test.functional.shada.testutil') local get_shada_rw = t_shada.get_shada_rw local function reset(shada_file) diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index f06d4d9c54..200a5f34b2 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -1,13 +1,14 @@ +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local t = require('test.functional.testutil')() -local clear = t.clear -local exec = t.exec -local exec_lua = t.exec_lua +local clear = n.clear +local exec = n.exec +local exec_lua = n.exec_lua local eq = t.eq -local fn = t.fn -local api = t.api -local insert = t.insert +local fn = n.fn +local api = n.api +local insert = n.insert local function html_syntax_match() local styles = diff --git a/test/functional/plugin/tutor_spec.lua b/test/functional/plugin/tutor_spec.lua index b8d5dc9399..9f381d45db 100644 --- a/test/functional/plugin/tutor_spec.lua +++ b/test/functional/plugin/tutor_spec.lua @@ -1,8 +1,10 @@ +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local t = require('test.functional.testutil')() -local clear = t.clear -local command = t.command -local feed = t.feed + +local clear = n.clear +local command = n.command +local feed = n.feed local is_os = t.is_os describe(':Tutor', function() diff --git a/test/functional/plugin/vim_syntax_spec.lua b/test/functional/plugin/vim_syntax_spec.lua index d31d6ad2f2..d99a69eab9 100644 --- a/test/functional/plugin/vim_syntax_spec.lua +++ b/test/functional/plugin/vim_syntax_spec.lua @@ -1,15 +1,16 @@ -local t = require('test.functional.testutil')() +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local clear = t.clear -local exec = t.exec -local api = t.api + +local clear = n.clear +local exec = n.exec +local api = n.api describe('Vimscript syntax highlighting', function() local screen --- @type test.functional.ui.screen before_each(function() clear() - t.add_builddir_to_rtp() + n.add_builddir_to_rtp() exec([[ setfiletype vim syntax on |