diff options
author | dundargoc <gocdundar@gmail.com> | 2024-04-08 11:03:20 +0200 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-04-08 22:51:00 +0200 |
commit | 7035125b2b26aa68fcfb7cda39377ac79926a0f9 (patch) | |
tree | d194a3556a367b42505f9e7d26637e7cb3674928 | |
parent | 978962f9a00ce75216d2c36b79397ef3d2b54096 (diff) | |
download | rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.gz rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.bz2 rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.zip |
test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
488 files changed, 4220 insertions, 4279 deletions
diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 6f93f73bc0..c862c88acf 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -46,7 +46,7 @@ if(DEFINED ENV{TEST_FILTER_OUT} AND NOT "$ENV{TEST_FILTER_OUT}" STREQUAL "") list(APPEND BUSTED_ARGS --filter-out $ENV{TEST_FILTER_OUT}) endif() -# TMPDIR: for helpers.tmpname() and Nvim tempname(). +# TMPDIR: for testutil.tmpname() and Nvim tempname(). set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR}) @@ -57,7 +57,7 @@ if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "") set(ENV{TEST_TIMEOUT} 1200) endif() -set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua. +set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/testutil.lua. if(NOT WIN32) # Tests assume POSIX "sh" and may fail if SHELL=fish. #24941 #6172 diff --git a/runtime/doc/dev_tools.txt b/runtime/doc/dev_tools.txt index 3ee48bec90..a89c1b35b6 100644 --- a/runtime/doc/dev_tools.txt +++ b/runtime/doc/dev_tools.txt @@ -88,7 +88,7 @@ Then, in another terminal: gdb build/bin/nvim target remote localhost:7777 < -- See also test/functional/helpers.lua https://github.com/neovim/neovim/blob/3098b18a2b63a841351f6d5e3697cb69db3035ef/test/functional/helpers.lua#L38-L44. +- See also test/functional/testutil.lua https://github.com/neovim/neovim/blob/3098b18a2b63a841351f6d5e3697cb69db3035ef/test/functional/testutil.lua#L38-L44. USING LLDB TO STEP THROUGH UNIT TESTS ~ diff --git a/scripts/legacy2luatest.pl b/scripts/legacy2luatest.pl index 8155353fc7..84a8889c82 100755 --- a/scripts/legacy2luatest.pl +++ b/scripts/legacy2luatest.pl @@ -282,9 +282,9 @@ open my $spec_file_handle, ">", $spec_file; print $spec_file_handle <<"EOS"; @{[join "\n", @{$description_lines}]} -local helpers = require('test.functional.helpers') -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect +local t = require('test.functional.testutil') +local feed, insert, source = t.feed, t.insert, t.source +local clear, execute, expect = t.clear, t.execute, t.expect describe('$test_name', function() before_each(clear) diff --git a/test/README.md b/test/README.md index a86f6ee818..3c8a4a60a6 100644 --- a/test/README.md +++ b/test/README.md @@ -44,9 +44,9 @@ Layout parser: normally used to make macros not accessible via this mechanism accessible the other way. - `/test/*/preload.lua` : modules preloaded by busted `--helper` option -- `/test/**/helpers.lua` : common utility functions for test code +- `/test/**/testutil.lua` : common utility functions for test code - `/test/*/**/*_spec.lua` : actual tests. Files that do not end with - `_spec.lua` are libraries like `/test/**/helpers.lua`, except that they have + `_spec.lua` are libraries like `/test/**/testutil.lua`, except that they have some common topic. - `/test/old/testdir` : old tests (from Vim) @@ -119,7 +119,7 @@ Debugging tests If `$VALGRIND` is also set it will pass `--vgdb=yes` to valgrind instead of starting gdbserver directly. - See [test/functional/helpers.lua](https://github.com/neovim/neovim/blob/9cadbf1d36b63f53f0de48c8c5ff6c752ff05d70/test/functional/helpers.lua#L52-L69) for details. + See [test/functional/testutil.lua](https://github.com/neovim/neovim/blob/9cadbf1d36b63f53f0de48c8c5ff6c752ff05d70/test/functional/testutil.lua#L52-L69) for details. - Hanging tests can happen due to unexpected "press-enter" prompts. The default screen width is 50 columns. Commands that try to print lines longer @@ -218,7 +218,7 @@ Guidelines - Luajit needs to know about type and constant declarations used in function prototypes. The - [helpers.lua](https://github.com/neovim/neovim/blob/master/test/unit/helpers.lua) + [testutil.lua](https://github.com/neovim/neovim/blob/master/test/unit/testutil.lua) file automatically parses `types.h`, so types used in the tested functions could be moved to it to avoid having to rewrite the declarations in the test files. @@ -297,7 +297,7 @@ Number; !must be defined to function properly): - `VALGRIND` (F) (D): makes nvim instances to be run under `valgrind`. Log files are named `valgrind-%p.log` in this case. Note that non-empty valgrind log may fail tests. Valgrind arguments may be seen in - `/test/functional/helpers.lua`. May be used in conjunction with `GDB`. + `/test/functional/testutil.lua`. May be used in conjunction with `GDB`. - `VALGRIND_LOG` (F) (S): overrides valgrind log file name used for `VALGRIND`. diff --git a/test/benchmark/autocmd_spec.lua b/test/benchmark/autocmd_spec.lua index b3421d86eb..0d0d37690f 100644 --- a/test/benchmark/autocmd_spec.lua +++ b/test/benchmark/autocmd_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua +local clear = t.clear +local exec_lua = t.exec_lua local N = 7500 diff --git a/test/benchmark/bench_regexp_spec.lua b/test/benchmark/bench_regexp_spec.lua index 4a7c50557b..9c0b86b6b5 100644 --- a/test/benchmark/bench_regexp_spec.lua +++ b/test/benchmark/bench_regexp_spec.lua @@ -1,8 +1,8 @@ -- Test for benchmarking the RE engine. -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, command = helpers.clear, helpers.command +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, command = t.clear, t.command -- Temporary file for gathering benchmarking results for each regexp engine. local result_file = 'benchmark.out' diff --git a/test/benchmark/preload.lua b/test/benchmark/preload.lua index 1971ef77cc..9e24b5cdf1 100644 --- a/test/benchmark/preload.lua +++ b/test/benchmark/preload.lua @@ -1,4 +1,4 @@ -- Modules loaded here will not be cleared and reloaded by Busted. -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. -local helpers = require('test.functional.helpers') +local t = require('test.functional.testutil') diff --git a/test/benchmark/screenpos_spec.lua b/test/benchmark/screenpos_spec.lua index 8a80712dfa..bd6860f313 100644 --- a/test/benchmark/screenpos_spec.lua +++ b/test/benchmark/screenpos_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local api = t.api local Screen = require('test.functional.ui.screen') local function rand_utf8(count, seed) @@ -78,7 +78,7 @@ local N = 10000 local function benchmark(lines, expected_value) local lnum = #lines - local results = helpers.exec_lua( + local results = t.exec_lua( [==[ local N, lnum = ... @@ -99,7 +99,7 @@ local function benchmark(lines, expected_value) ) for _, value in ipairs(results[1]) do - helpers.eq(expected_value, value) + t.eq(expected_value, value) end local stats = results[2] table.sort(stats) @@ -119,7 +119,7 @@ end local function benchmarks(benchmark_results) describe('screenpos() perf', function() - before_each(helpers.clear) + before_each(t.clear) -- no breakindent for li, lines_type in ipairs(benchmark_lines) do @@ -134,7 +134,7 @@ local function benchmarks(benchmark_results) screen:attach() api.nvim_buf_set_lines(0, 0, 1, false, lines) -- for smaller screen expect (last line always different, first line same as others) - helpers.feed('G$') + t.feed('G$') screen:expect(result.screen) benchmark(lines, result.value) end) @@ -153,9 +153,9 @@ local function benchmarks(benchmark_results) local screen = Screen.new(width, height + 1) screen:attach() api.nvim_buf_set_lines(0, 0, 1, false, lines) - helpers.command('set breakindent') + t.command('set breakindent') -- for smaller screen expect (last line always different, first line same as others) - helpers.feed('G$') + t.feed('G$') screen:expect(result.screen) benchmark(lines, result.value) end) diff --git a/test/benchmark/treesitter_spec.lua b/test/benchmark/treesitter_spec.lua index 7c9906a7b2..18b9241081 100644 --- a/test/benchmark/treesitter_spec.lua +++ b/test/benchmark/treesitter_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua +local clear = t.clear +local exec_lua = t.exec_lua describe('treesitter perf', function() setup(function() @@ -9,7 +9,7 @@ describe('treesitter perf', function() end) it('can handle large folds', function() - helpers.command 'edit ./src/nvim/eval.c' + t.command 'edit ./src/nvim/eval.c' exec_lua [[ local parser = vim.treesitter.get_parser(0, "c", {}) vim.treesitter.highlighter.new(parser) diff --git a/test/busted/outputHandlers/TAP.lua b/test/busted/outputHandlers/TAP.lua index 5de48c0ad3..2439547050 100644 --- a/test/busted/outputHandlers/TAP.lua +++ b/test/busted/outputHandlers/TAP.lua @@ -1,13 +1,13 @@ -- Extends the upstream TAP handler, to display the log with suiteEnd. -local global_helpers = require('test.helpers') +local t_global = require('test.testutil') return function(options) local busted = require 'busted' local handler = require 'busted.outputHandlers.TAP'(options) local suiteEnd = function() - io.write(global_helpers.read_nvim_log(nil, true)) + io.write(t_global.read_nvim_log(nil, true)) return nil, true end busted.subscribe({ 'suite', 'end' }, suiteEnd) diff --git a/test/busted/outputHandlers/nvim.lua b/test/busted/outputHandlers/nvim.lua index 28855df261..a090761b5d 100644 --- a/test/busted/outputHandlers/nvim.lua +++ b/test/busted/outputHandlers/nvim.lua @@ -1,5 +1,5 @@ local pretty = require 'pl.pretty' -local global_helpers = require('test.helpers') +local t_global = require('test.testutil') local colors = setmetatable({}, { __index = function() @@ -236,7 +236,7 @@ return function(options) io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms)) io.write(getSummaryString()) if failureCount > 0 or errorCount > 0 then - io.write(global_helpers.read_nvim_log(nil, true)) + io.write(t_global.read_nvim_log(nil, true)) end io.flush() diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua index e89abf6c64..b97647850c 100644 --- a/test/functional/api/autocmd_spec.lua +++ b/test/functional/api/autocmd_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local neq = helpers.neq -local exec_lua = helpers.exec_lua -local matches = helpers.matches -local api = helpers.api -local source = helpers.source -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local eq = t.eq +local neq = t.neq +local exec_lua = t.exec_lua +local matches = t.matches +local api = t.api +local source = t.source +local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua index 25b0405571..de56c16bd8 100644 --- a/test/functional/api/buffer_spec.lua +++ b/test/functional/api/buffer_spec.lua @@ -1,21 +1,21 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local eq = helpers.eq -local ok = helpers.ok -local describe_lua_and_rpc = helpers.describe_lua_and_rpc(describe) -local api = helpers.api -local fn = helpers.fn -local request = helpers.request -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local feed_command = helpers.feed_command -local insert = helpers.insert +local clear = t.clear +local eq = t.eq +local ok = t.ok +local describe_lua_and_rpc = t.describe_lua_and_rpc(describe) +local api = t.api +local fn = t.fn +local request = t.request +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local feed_command = t.feed_command +local insert = t.insert local NIL = vim.NIL -local command = helpers.command -local feed = helpers.feed -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive +local command = t.command +local feed = t.feed +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive describe('api/buf', function() before_each(clear) diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua index 262ca40e28..715c469c76 100644 --- a/test/functional/api/buffer_updates_spec.lua +++ b/test/functional/api/buffer_updates_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq, ok = helpers.eq, helpers.ok -local fn = helpers.fn -local api = helpers.api -local command, eval, next_msg = helpers.command, helpers.eval, helpers.next_msg -local nvim_prog = helpers.nvim_prog -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq, ok = t.eq, t.ok +local fn = t.fn +local api = t.api +local command, eval, next_msg = t.command, t.eval, t.next_msg +local nvim_prog = t.nvim_prog +local pcall_err = t.pcall_err local sleep = vim.uv.sleep -local write_file = helpers.write_file +local write_file = t.write_file local origlines = { 'original line 1', @@ -34,7 +34,7 @@ local function sendkeys(keys) end local function open(activate, lines) - local filename = helpers.tmpname() + local filename = t.tmpname() write_file(filename, table.concat(lines, '\n') .. '\n', true) command('edit ' .. filename) local b = api.nvim_get_current_buf() @@ -511,11 +511,11 @@ describe('API: buffer events:', function() -- create several new sessions, in addition to our main API local sessions = {} - local pipe = helpers.new_pipename() + local pipe = t.new_pipename() eval("serverstart('" .. pipe .. "')") - sessions[1] = helpers.connect(pipe) - sessions[2] = helpers.connect(pipe) - sessions[3] = helpers.connect(pipe) + sessions[1] = t.connect(pipe) + sessions[2] = t.connect(pipe) + sessions[3] = t.connect(pipe) local function request(sessionnr, method, ...) local status, rv = sessions[sessionnr]:request(method, ...) @@ -814,7 +814,7 @@ describe('API: buffer events:', function() clear() sleep(250) -- response - eq(true, helpers.request('nvim_buf_attach', 0, false, {})) + eq(true, t.request('nvim_buf_attach', 0, false, {})) -- notification eq({ [1] = 'notification', diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua index f73b9c8b13..29d96a1ff5 100644 --- a/test/functional/api/command_spec.lua +++ b/test/functional/api/command_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local NIL = vim.NIL -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local api = helpers.api -local matches = helpers.matches -local source = helpers.source -local pcall_err = helpers.pcall_err -local exec_lua = helpers.exec_lua -local assert_alive = helpers.assert_alive -local feed = helpers.feed -local fn = helpers.fn +local clear = t.clear +local command = t.command +local eq = t.eq +local api = t.api +local matches = t.matches +local source = t.source +local pcall_err = t.pcall_err +local exec_lua = t.exec_lua +local assert_alive = t.assert_alive +local feed = t.feed +local fn = t.fn describe('nvim_get_commands', function() local cmd_dict = { diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 4cf96a4af6..1a96510d3d 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local request = helpers.request -local eq = helpers.eq -local ok = helpers.ok -local pcall_err = helpers.pcall_err -local insert = helpers.insert -local feed = helpers.feed -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local api = helpers.api -local assert_alive = helpers.assert_alive +local request = t.request +local eq = t.eq +local ok = t.ok +local pcall_err = t.pcall_err +local insert = t.insert +local feed = t.feed +local clear = t.clear +local command = t.command +local exec = t.exec +local api = t.api +local assert_alive = t.assert_alive local function expect(contents) - return eq(contents, helpers.curbuf_contents()) + return eq(contents, t.curbuf_contents()) end local function set_extmark(ns_id, id, line, col, opts) diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 1973d3e1c7..4156af5901 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear +local t = require('test.functional.testutil')(after_each) +local clear = t.clear local Screen = require('test.functional.ui.screen') -local eq, eval = helpers.eq, helpers.eval -local command = helpers.command -local exec_capture = helpers.exec_capture -local api = helpers.api -local fn = helpers.fn -local pcall_err = helpers.pcall_err -local ok = helpers.ok -local assert_alive = helpers.assert_alive +local eq, eval = t.eq, t.eval +local command = t.command +local exec_capture = t.exec_capture +local api = t.api +local fn = t.fn +local pcall_err = t.pcall_err +local ok = t.ok +local assert_alive = t.assert_alive describe('API: highlight', function() clear() diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index 4380e76486..d6a8b592d7 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local eq, neq = helpers.eq, helpers.neq -local exec_lua = helpers.exec_lua -local exec = helpers.exec -local feed = helpers.feed -local fn = helpers.fn -local api = helpers.api -local source = helpers.source -local pcall_err = helpers.pcall_err - -local shallowcopy = helpers.shallowcopy +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local eq, neq = t.eq, t.neq +local exec_lua = t.exec_lua +local exec = t.exec +local feed = t.feed +local fn = t.fn +local api = t.api +local source = t.source +local pcall_err = t.pcall_err + +local shallowcopy = t.shallowcopy local sleep = vim.uv.sleep local sid_api_client = -9 @@ -1114,7 +1114,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function() feed('asdf\n') eq(1, exec_lua [[return GlobalCount]]) - eq('\nNo mapping found', helpers.exec_capture('nmap asdf')) + eq('\nNo mapping found', t.exec_capture('nmap asdf')) end) it('no double-free when unmapping simplifiable lua mappings', function() @@ -1138,13 +1138,13 @@ describe('nvim_set_keymap, nvim_del_keymap', function() feed('<C-I>\n') eq(1, exec_lua [[return GlobalCount]]) - eq('\nNo mapping found', helpers.exec_capture('nmap <C-I>')) + eq('\nNo mapping found', t.exec_capture('nmap <C-I>')) end) it('can set descriptions on mappings', function() api.nvim_set_keymap('n', 'lhs', 'rhs', { desc = 'map description' }) eq(generate_mapargs('n', 'lhs', 'rhs', { desc = 'map description' }), get_mapargs('n', 'lhs')) - eq('\nn lhs rhs\n map description', helpers.exec_capture('nmap lhs')) + eq('\nn lhs rhs\n map description', t.exec_capture('nmap lhs')) end) it('can define !-mode abbreviations with lua callbacks', function() @@ -1290,7 +1290,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function() it('does not crash when setting mapping in a non-existing buffer #13541', function() pcall_err(api.nvim_buf_set_keymap, 100, '', 'lsh', 'irhs<Esc>', {}) - helpers.assert_alive() + t.assert_alive() end) it('can make lua mappings', function() @@ -1372,7 +1372,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function() feed('asdf\n') eq(1, exec_lua [[return GlobalCount]]) - eq('\nNo mapping found', helpers.exec_capture('nmap asdf')) + eq('\nNo mapping found', t.exec_capture('nmap asdf')) end) it('no double-free when unmapping simplifiable lua mappings', function() @@ -1396,6 +1396,6 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function() feed('<C-I>\n') eq(1, exec_lua [[return GlobalCount]]) - eq('\nNo mapping found', helpers.exec_capture('nmap <C-I>')) + eq('\nNo mapping found', t.exec_capture('nmap <C-I>')) end) end) diff --git a/test/functional/api/menu_spec.lua b/test/functional/api/menu_spec.lua index 44b9039393..97d0f43d64 100644 --- a/test/functional/api/menu_spec.lua +++ b/test/functional/api/menu_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed +local clear = t.clear +local command = t.command +local feed = t.feed describe('update_menu notification', function() local screen diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua index 50c441792c..85e55d0cfb 100644 --- a/test/functional/api/proc_spec.lua +++ b/test/functional/api/proc_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local fn = helpers.fn -local neq = helpers.neq -local nvim_argv = helpers.nvim_argv -local request = helpers.request -local retry = helpers.retry +local clear = t.clear +local eq = t.eq +local fn = t.fn +local neq = t.neq +local nvim_argv = t.nvim_argv +local request = t.request +local retry = t.retry local NIL = vim.NIL -local is_os = helpers.is_os +local is_os = t.is_os describe('API', function() before_each(clear) diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua index 9b411c0c3f..ee2e401dd5 100644 --- a/test/functional/api/server_notifications_spec.lua +++ b/test/functional/api/server_notifications_spec.lua @@ -1,12 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_log = helpers.assert_log -local eq, clear, eval, command, next_msg = - helpers.eq, helpers.clear, helpers.eval, helpers.command, helpers.next_msg -local api = helpers.api -local exec_lua = helpers.exec_lua -local retry = helpers.retry -local assert_alive = helpers.assert_alive -local check_close = helpers.check_close +local t = require('test.functional.testutil')(after_each) +local assert_log = t.assert_log +local eq, clear, eval, command, next_msg = t.eq, t.clear, t.eval, t.command, t.next_msg +local api = t.api +local exec_lua = t.exec_lua +local retry = t.retry +local assert_alive = t.assert_alive +local check_close = t.check_close local testlog = 'Xtest-server-notify-log' diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index 562eeae951..3a925dcbe2 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -1,17 +1,17 @@ -- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate -- `rpcrequest` calls we need the client event loop to be running. -local helpers = require('test.functional.helpers')(after_each) - -local clear, eval = helpers.clear, helpers.eval -local eq, neq, run, stop = helpers.eq, helpers.neq, helpers.run, helpers.stop -local nvim_prog, command, fn = helpers.nvim_prog, helpers.command, helpers.fn -local source, next_msg = helpers.source, helpers.next_msg -local ok = helpers.ok -local api = helpers.api -local spawn, merge_args = helpers.spawn, helpers.merge_args -local set_session = helpers.set_session -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive +local t = require('test.functional.testutil')(after_each) + +local clear, eval = t.clear, t.eval +local eq, neq, run, stop = t.eq, t.neq, t.run, t.stop +local nvim_prog, command, fn = t.nvim_prog, t.command, t.fn +local source, next_msg = t.source, t.next_msg +local ok = t.ok +local api = t.api +local spawn, merge_args = t.spawn, t.merge_args +local set_session = t.set_session +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive describe('server -> client', function() local cid @@ -259,7 +259,7 @@ describe('server -> client', function() pcall(fn.jobstop, jobid) end) - if helpers.skip(helpers.is_os('win')) then + if t.skip(t.is_os('win')) then return end @@ -280,7 +280,7 @@ describe('server -> client', function() end) describe('connecting to another (peer) nvim', function() - local nvim_argv = merge_args(helpers.nvim_argv, { '--headless' }) + local nvim_argv = merge_args(t.nvim_argv, { '--headless' }) local function connect_test(server, mode, address) local serverpid = fn.getpid() local client = spawn(nvim_argv, false, nil, true) diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua index f7e6eed047..6ed5daca0f 100644 --- a/test/functional/api/tabpage_spec.lua +++ b/test/functional/api/tabpage_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api -local fn = helpers.fn -local request = helpers.request +local t = require('test.functional.testutil')(after_each) +local clear, eq, ok = t.clear, t.eq, t.ok +local exec = t.exec +local feed = t.feed +local api = t.api +local fn = t.fn +local request = t.request local NIL = vim.NIL -local pcall_err = helpers.pcall_err -local command = helpers.command +local pcall_err = t.pcall_err +local command = t.command describe('api/tabpage', function() before_each(clear) diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua index 3e1f1ec965..89eeeaa189 100644 --- a/test/functional/api/ui_spec.lua +++ b/test/functional/api/ui_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api -local request = helpers.request -local pcall_err = helpers.pcall_err +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local exec = t.exec +local feed = t.feed +local api = t.api +local request = t.request +local pcall_err = t.pcall_err describe('nvim_ui_attach()', function() before_each(function() diff --git a/test/functional/api/version_spec.lua b/test/functional/api/version_spec.lua index c304f1aa88..7ab27be298 100644 --- a/test/functional/api/version_spec.lua +++ b/test/functional/api/version_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, fn, eq = helpers.clear, helpers.fn, helpers.eq -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local clear, fn, eq = t.clear, t.fn, t.eq +local api = t.api local function read_mpack_file(fname) local fd = io.open(fname, 'rb') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index dc36926641..82d5480997 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -1,42 +1,42 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') local uv = vim.uv local fmt = string.format -local dedent = helpers.dedent -local assert_alive = helpers.assert_alive +local dedent = t.dedent +local assert_alive = t.assert_alive local NIL = vim.NIL -local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq -local command = helpers.command -local command_output = helpers.api.nvim_command_output -local exec = helpers.exec -local exec_capture = helpers.exec_capture -local eval = helpers.eval -local expect = helpers.expect -local fn = helpers.fn -local api = helpers.api -local matches = helpers.matches +local clear, eq, neq = t.clear, t.eq, t.neq +local command = t.command +local command_output = t.api.nvim_command_output +local exec = t.exec +local exec_capture = t.exec_capture +local eval = t.eval +local expect = t.expect +local fn = t.fn +local api = t.api +local matches = t.matches local pesc = vim.pesc -local mkdir_p = helpers.mkdir_p -local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed -local async_meths = helpers.async_meths -local is_os = helpers.is_os -local parse_context = helpers.parse_context -local request = helpers.request -local rmdir = helpers.rmdir -local source = helpers.source -local next_msg = helpers.next_msg -local tmpname = helpers.tmpname -local write_file = helpers.write_file -local exec_lua = helpers.exec_lua -local exc_exec = helpers.exc_exec -local insert = helpers.insert -local skip = helpers.skip - -local pcall_err = helpers.pcall_err +local mkdir_p = t.mkdir_p +local ok, nvim_async, feed = t.ok, t.nvim_async, t.feed +local async_meths = t.async_meths +local is_os = t.is_os +local parse_context = t.parse_context +local request = t.request +local rmdir = t.rmdir +local source = t.source +local next_msg = t.next_msg +local tmpname = t.tmpname +local write_file = t.write_file +local exec_lua = t.exec_lua +local exc_exec = t.exc_exec +local insert = t.insert +local skip = t.skip + +local pcall_err = t.pcall_err local format_string = require('test.format_string').format_string -local intchar2lua = helpers.intchar2lua -local mergedicts_copy = helpers.mergedicts_copy +local intchar2lua = t.intchar2lua +local mergedicts_copy = t.mergedicts_copy local endswith = vim.endswith describe('API', function() @@ -702,12 +702,12 @@ describe('API', function() end) after_each(function() - helpers.rmdir('Xtestdir') + t.rmdir('Xtestdir') end) it('works', function() api.nvim_set_current_dir('Xtestdir') - eq(start_dir .. helpers.get_pathsep() .. 'Xtestdir', fn.getcwd()) + eq(start_dir .. t.get_pathsep() .. 'Xtestdir', fn.getcwd()) end) it('sets previous directory', function() @@ -1467,7 +1467,7 @@ describe('API', function() eq(NIL, api.nvim_get_var('Unknown_script_func')) -- Check if autoload works properly - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() local xconfig = 'Xhome' .. pathsep .. 'Xconfig' local xdata = 'Xhome' .. pathsep .. 'Xdata' local autoload_folder = table.concat({ xconfig, 'nvim', 'autoload' }, pathsep) @@ -1951,7 +1951,7 @@ describe('API', function() describe('RPC (K_EVENT)', function() it('does not complete ("interrupt") normal-mode operator-pending #6166', function() - helpers.insert([[ + t.insert([[ FIRST LINE SECOND LINE]]) api.nvim_input('gg') @@ -1988,7 +1988,7 @@ describe('API', function() it('does not complete ("interrupt") normal-mode map-pending #6166', function() command("nnoremap dd :let g:foo='it worked...'<CR>") - helpers.insert([[ + t.insert([[ FIRST LINE SECOND LINE]]) api.nvim_input('gg') @@ -2000,13 +2000,13 @@ describe('API', function() expect([[ FIRST LINE SECOND LINE]]) - eq('it worked...', helpers.eval('g:foo')) + eq('it worked...', t.eval('g:foo')) end) it('does not complete ("interrupt") insert-mode map-pending #6166', function() command('inoremap xx foo') command('set timeoutlen=9999') - helpers.insert([[ + t.insert([[ FIRST LINE SECOND LINE]]) api.nvim_input('ix') @@ -2153,35 +2153,32 @@ describe('API', function() describe('nvim_replace_termcodes', function() it('escapes K_SPECIAL as K_SPECIAL KS_SPECIAL KE_FILLER', function() - eq('\128\254X', helpers.api.nvim_replace_termcodes('\128', true, true, true)) + eq('\128\254X', t.api.nvim_replace_termcodes('\128', true, true, true)) end) it('leaves non-K_SPECIAL string unchanged', function() - eq('abc', helpers.api.nvim_replace_termcodes('abc', true, true, true)) + eq('abc', t.api.nvim_replace_termcodes('abc', true, true, true)) end) it('converts <expressions>', function() - eq('\\', helpers.api.nvim_replace_termcodes('<Leader>', true, true, true)) + eq('\\', t.api.nvim_replace_termcodes('<Leader>', true, true, true)) end) it('converts <LeftMouse> to K_SPECIAL KS_EXTRA KE_LEFTMOUSE', function() -- K_SPECIAL KS_EXTRA KE_LEFTMOUSE -- 0x80 0xfd 0x2c -- 128 253 44 - eq('\128\253\44', helpers.api.nvim_replace_termcodes('<LeftMouse>', true, true, true)) + eq('\128\253\44', t.api.nvim_replace_termcodes('<LeftMouse>', true, true, true)) end) it('converts keycodes', function() - eq( - '\nx\27x\rx<x', - helpers.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, true) - ) + eq('\nx\27x\rx<x', t.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, true)) end) it('does not convert keycodes if special=false', function() eq( '<NL>x<Esc>x<CR>x<lt>x', - helpers.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, false) + t.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, false) ) end) @@ -2210,18 +2207,18 @@ describe('API', function() api.nvim_feedkeys(':let x1="…"\n', '', true) -- Both nvim_replace_termcodes and nvim_feedkeys escape \x80 - local inp = helpers.api.nvim_replace_termcodes(':let x2="…"<CR>', true, true, true) + local inp = t.api.nvim_replace_termcodes(':let x2="…"<CR>', true, true, true) api.nvim_feedkeys(inp, '', true) -- escape_ks=true -- nvim_feedkeys with K_SPECIAL escaping disabled - inp = helpers.api.nvim_replace_termcodes(':let x3="…"<CR>', true, true, true) + inp = t.api.nvim_replace_termcodes(':let x3="…"<CR>', true, true, true) api.nvim_feedkeys(inp, '', false) -- escape_ks=false - helpers.stop() + t.stop() end -- spin the loop a bit - helpers.run(nil, nil, on_setup) + t.run(nil, nil, on_setup) eq('…', api.nvim_get_var('x1')) -- Because of the double escaping this is neq @@ -2364,7 +2361,7 @@ describe('API', function() {0:~ }|*6 {1:very fail} | ]]) - helpers.poke_eventloop() + t.poke_eventloop() -- shows up to &cmdheight lines async_meths.nvim_err_write('more fail\ntoo fail\n') @@ -2676,7 +2673,7 @@ describe('API', function() describe('nvim_list_runtime_paths', function() setup(function() - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() mkdir_p('Xtest' .. pathsep .. 'a') mkdir_p('Xtest' .. pathsep .. 'b') end) @@ -3183,7 +3180,7 @@ describe('API', function() end) describe('nvim_get_runtime_file', function() - local p = helpers.alter_slashes + local p = t.alter_slashes it('can find files', function() eq({}, api.nvim_get_runtime_file('bork.borkbork', false)) eq({}, api.nvim_get_runtime_file('bork.borkbork', true)) @@ -3410,13 +3407,13 @@ describe('API', function() {desc="(global option, fallback requested) points to global", linenr=9, sid=1, args={'completeopt', {}}}, } - for _, t in pairs(tests) do - it(t.desc, function() + for _, test in pairs(tests) do + it(test.desc, function() -- Switch to the target buffer/window so that curbuf/curwin are used. api.nvim_set_current_win(wins[2]) - local info = api.nvim_get_option_info2(unpack(t.args)) - eq(t.linenr, info.last_set_linenr) - eq(t.sid, info.last_set_sid) + local info = api.nvim_get_option_info2(unpack(test.args)) + eq(test.linenr, info.last_set_linenr) + eq(test.sid, info.last_set_sid) end) end @@ -3537,9 +3534,9 @@ describe('API', function() false, { width = 79, height = 31, row = 1, col = 1, relative = 'editor' } ) - local t = api.nvim_open_term(b, {}) + local term = api.nvim_open_term(b, {}) - api.nvim_chan_send(t, io.open('test/functional/fixtures/smile2.cat', 'r'):read('*a')) + api.nvim_chan_send(term, io.open('test/functional/fixtures/smile2.cat', 'r'):read('*a')) screen:expect { grid = [[ ^ | diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 721148faaa..43f1a05414 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -1,27 +1,27 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') local clear, curbuf, curbuf_contents, curwin, eq, neq, matches, ok, feed, insert, eval = - helpers.clear, - helpers.api.nvim_get_current_buf, - helpers.curbuf_contents, - helpers.api.nvim_get_current_win, - helpers.eq, - helpers.neq, - helpers.matches, - helpers.ok, - helpers.feed, - helpers.insert, - helpers.eval -local poke_eventloop = helpers.poke_eventloop -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local fn = helpers.fn -local request = helpers.request + t.clear, + t.api.nvim_get_current_buf, + t.curbuf_contents, + t.api.nvim_get_current_win, + t.eq, + t.neq, + t.matches, + t.ok, + t.feed, + t.insert, + t.eval +local poke_eventloop = t.poke_eventloop +local exec = t.exec +local exec_lua = t.exec_lua +local fn = t.fn +local request = t.request local NIL = vim.NIL -local api = helpers.api -local command = helpers.command -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive +local api = t.api +local command = t.command +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive describe('API/win', function() before_each(clear) @@ -1297,7 +1297,7 @@ describe('API/win', function() local tab1 = api.nvim_get_current_tabpage() local tab1_win = api.nvim_get_current_win() - helpers.command('tabnew') + t.command('tabnew') local tab2 = api.nvim_get_current_tabpage() local tab2_win = api.nvim_get_current_win() diff --git a/test/functional/autocmd/autocmd_oldtest_spec.lua b/test/functional/autocmd/autocmd_oldtest_spec.lua index f1d891cddf..8b72fb57c3 100644 --- a/test/functional/autocmd/autocmd_oldtest_spec.lua +++ b/test/functional/autocmd/autocmd_oldtest_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local eq = helpers.eq -local api = helpers.api -local fn = helpers.fn -local exec = helpers.exec -local feed = helpers.feed -local assert_log = helpers.assert_log -local check_close = helpers.check_close -local is_os = helpers.is_os +local clear = t.clear +local eq = t.eq +local api = t.api +local fn = t.fn +local exec = t.exec +local feed = t.feed +local assert_log = t.assert_log +local check_close = t.check_close +local is_os = t.is_os local testlog = 'Xtest_autocmd_oldtest_log' diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index 8fa0ccec5a..bee64c98b9 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -1,24 +1,24 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_visible = helpers.assert_visible -local assert_alive = helpers.assert_alive -local dedent = helpers.dedent -local eq = helpers.eq -local neq = helpers.neq -local eval = helpers.eval -local feed = helpers.feed -local clear = helpers.clear -local matches = helpers.matches -local api = helpers.api -local pcall_err = helpers.pcall_err -local fn = helpers.fn -local expect = helpers.expect -local command = helpers.command -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local retry = helpers.retry -local source = helpers.source +local assert_visible = t.assert_visible +local assert_alive = t.assert_alive +local dedent = t.dedent +local eq = t.eq +local neq = t.neq +local eval = t.eval +local feed = t.feed +local clear = t.clear +local matches = t.matches +local api = t.api +local pcall_err = t.pcall_err +local fn = t.fn +local expect = t.expect +local command = t.command +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local retry = t.retry +local source = t.source describe('autocmd', function() before_each(clear) diff --git a/test/functional/autocmd/bufenter_spec.lua b/test/functional/autocmd/bufenter_spec.lua index af0dd887fa..ca67099eb7 100644 --- a/test/functional/autocmd/bufenter_spec.lua +++ b/test/functional/autocmd/bufenter_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local request = helpers.request -local source = helpers.source +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local request = t.request +local source = t.source describe('autocmd BufEnter', function() before_each(clear) @@ -33,7 +33,7 @@ describe('autocmd BufEnter', function() end) it('triggered by ":split normal|:help|:bw"', function() - helpers.add_builddir_to_rtp() + t.add_builddir_to_rtp() command('split normal') command('wincmd j') command('help') diff --git a/test/functional/autocmd/bufmodifiedset_spec.lua b/test/functional/autocmd/bufmodifiedset_spec.lua index 27fe9fcc94..e10bb8be20 100644 --- a/test/functional/autocmd/bufmodifiedset_spec.lua +++ b/test/functional/autocmd/bufmodifiedset_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local source = helpers.source -local request = helpers.request +local clear = t.clear +local eq = t.eq +local eval = t.eval +local source = t.source +local request = t.request describe('BufModified', function() before_each(clear) diff --git a/test/functional/autocmd/cmdline_spec.lua b/test/functional/autocmd/cmdline_spec.lua index 7428456656..9ddeb947e3 100644 --- a/test/functional/autocmd/cmdline_spec.lua +++ b/test/functional/autocmd/cmdline_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local expect = helpers.expect -local eval = helpers.eval -local next_msg = helpers.next_msg -local feed = helpers.feed -local api = helpers.api +local clear = t.clear +local command = t.command +local eq = t.eq +local expect = t.expect +local eval = t.eval +local next_msg = t.next_msg +local feed = t.feed +local api = t.api describe('cmdline autocommands', function() local channel diff --git a/test/functional/autocmd/cursorhold_spec.lua b/test/functional/autocmd/cursorhold_spec.lua index fc2b65f53a..c65d6f11d7 100644 --- a/test/functional/autocmd/cursorhold_spec.lua +++ b/test/functional/autocmd/cursorhold_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local feed = helpers.feed -local retry = helpers.retry -local exec = helpers.source +local clear = t.clear +local eq = t.eq +local feed = t.feed +local retry = t.retry +local exec = t.source local sleep = vim.uv.sleep -local api = helpers.api +local api = t.api before_each(clear) diff --git a/test/functional/autocmd/cursormoved_spec.lua b/test/functional/autocmd/cursormoved_spec.lua index 302afe87b8..cd89ed416b 100644 --- a/test/functional/autocmd/cursormoved_spec.lua +++ b/test/functional/autocmd/cursormoved_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local api = helpers.api -local source = helpers.source -local command = helpers.command +local clear = t.clear +local eq = t.eq +local eval = t.eval +local api = t.api +local source = t.source +local command = t.command describe('CursorMoved', function() before_each(clear) diff --git a/test/functional/autocmd/dirchanged_spec.lua b/test/functional/autocmd/dirchanged_spec.lua index 7ad529891f..d089a2dbdb 100644 --- a/test/functional/autocmd/dirchanged_spec.lua +++ b/test/functional/autocmd/dirchanged_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local request = helpers.request -local is_os = helpers.is_os +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local request = t.request +local is_os = t.is_os describe('autocmd DirChanged and DirChangedPre', function() local curdir = vim.uv.cwd():gsub('\\', '/') @@ -22,12 +22,12 @@ describe('autocmd DirChanged and DirChangedPre', function() setup(function() for _, dir in pairs(dirs) do - helpers.mkdir(dir) + t.mkdir(dir) end end) teardown(function() for _, dir in pairs(dirs) do - helpers.rmdir(dir) + t.rmdir(dir) end end) diff --git a/test/functional/autocmd/filetype_spec.lua b/test/functional/autocmd/filetype_spec.lua index 648f830f27..b0482b37cf 100644 --- a/test/functional/autocmd/filetype_spec.lua +++ b/test/functional/autocmd/filetype_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eval = helpers.eval -local clear = helpers.clear -local command = helpers.command +local eval = t.eval +local clear = t.clear +local command = t.command describe('autocmd FileType', function() before_each(clear) it('is triggered by :help only once', function() - helpers.add_builddir_to_rtp() + t.add_builddir_to_rtp() command('let g:foo = 0') command('autocmd FileType help let g:foo = g:foo + 1') command('help help') diff --git a/test/functional/autocmd/focus_spec.lua b/test/functional/autocmd/focus_spec.lua index 4f4a036ba8..af4bcef702 100644 --- a/test/functional/autocmd/focus_spec.lua +++ b/test/functional/autocmd/focus_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local clear = helpers.clear -local feed_command = helpers.feed_command -local feed_data = thelpers.feed_data +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local clear = t.clear +local feed_command = t.feed_command +local feed_data = tt.feed_data -if helpers.skip(helpers.is_os('win')) then +if t.skip(t.is_os('win')) then return end @@ -14,7 +14,7 @@ describe('autoread TUI FocusGained/FocusLost', function() before_each(function() clear() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -39,7 +39,7 @@ describe('autoread TUI FocusGained/FocusLost', function() line 4 ]] - helpers.write_file(path, '') + t.write_file(path, '') local atime = os.time() - 10 vim.uv.fs_utime(path, atime, atime) @@ -75,7 +75,7 @@ describe('autoread TUI FocusGained/FocusLost', function() unchanged = true, } - helpers.write_file(path, expected_addition) + t.write_file(path, expected_addition) feed_data('\027[I') diff --git a/test/functional/autocmd/modechanged_spec.lua b/test/functional/autocmd/modechanged_spec.lua index 8ad914a597..c6724c868f 100644 --- a/test/functional/autocmd/modechanged_spec.lua +++ b/test/functional/autocmd/modechanged_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq -local feed, command = helpers.feed, helpers.command -local exec_lua = helpers.exec_lua +local t = require('test.functional.testutil')(after_each) +local clear, eval, eq = t.clear, t.eval, t.eq +local feed, command = t.feed, t.command +local exec_lua = t.exec_lua describe('ModeChanged', function() before_each(function() diff --git a/test/functional/autocmd/recording_spec.lua b/test/functional/autocmd/recording_spec.lua index b9aec774f1..c2d5ac0852 100644 --- a/test/functional/autocmd/recording_spec.lua +++ b/test/functional/autocmd/recording_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local source_vim = helpers.source +local clear = t.clear +local eq = t.eq +local eval = t.eval +local source_vim = t.source describe('RecordingEnter', function() before_each(clear) diff --git a/test/functional/autocmd/safestate_spec.lua b/test/functional/autocmd/safestate_spec.lua index b5b7ab2f95..8c2e7a78a0 100644 --- a/test/functional/autocmd/safestate_spec.lua +++ b/test/functional/autocmd/safestate_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local exec = t.exec +local feed = t.feed +local api = t.api before_each(clear) diff --git a/test/functional/autocmd/searchwrapped_spec.lua b/test/functional/autocmd/searchwrapped_spec.lua index 0705b2d5de..e9fd1f400c 100644 --- a/test/functional/autocmd/searchwrapped_spec.lua +++ b/test/functional/autocmd/searchwrapped_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local api = helpers.api -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local api = t.api +local eq = t.eq +local eval = t.eval +local feed = t.feed describe('autocmd SearchWrapped', function() before_each(function() diff --git a/test/functional/autocmd/show_spec.lua b/test/functional/autocmd/show_spec.lua index 1a9dc8a337..cc9eec8361 100644 --- a/test/functional/autocmd/show_spec.lua +++ b/test/functional/autocmd/show_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local dedent = helpers.dedent -local eq = helpers.eq -local fn = helpers.fn -local eval = helpers.eval -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local command = t.command +local dedent = t.dedent +local eq = t.eq +local fn = t.fn +local eval = t.eval +local exec = t.exec +local feed = t.feed describe(':autocmd', function() before_each(function() diff --git a/test/functional/autocmd/signal_spec.lua b/test/functional/autocmd/signal_spec.lua index c7087254e7..8c95b065fa 100644 --- a/test/functional/autocmd/signal_spec.lua +++ b/test/functional/autocmd/signal_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local fn = helpers.fn -local next_msg = helpers.next_msg -local is_os = helpers.is_os -local skip = helpers.skip +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local eq = t.eq +local fn = t.fn +local next_msg = t.next_msg +local is_os = t.is_os +local skip = t.skip if skip(is_os('win'), 'Only applies to POSIX systems') then return diff --git a/test/functional/autocmd/tabclose_spec.lua b/test/functional/autocmd/tabclose_spec.lua index d0b2ac6a8d..7a8c588c10 100644 --- a/test/functional/autocmd/tabclose_spec.lua +++ b/test/functional/autocmd/tabclose_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq = helpers.clear, helpers.eq -local api = helpers.api -local command = helpers.command +local t = require('test.functional.testutil')(after_each) +local clear, eq = t.clear, t.eq +local api = t.api +local command = t.command describe('TabClosed', function() before_each(clear) diff --git a/test/functional/autocmd/tabnew_spec.lua b/test/functional/autocmd/tabnew_spec.lua index ad40954f76..be7f4318fe 100644 --- a/test/functional/autocmd/tabnew_spec.lua +++ b/test/functional/autocmd/tabnew_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval describe('autocmd TabNew', function() before_each(clear) diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua index b888845e3b..52f8eb8706 100644 --- a/test/functional/autocmd/tabnewentered_spec.lua +++ b/test/functional/autocmd/tabnewentered_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local dedent = helpers.dedent -local eval = helpers.eval -local eq = helpers.eq -local feed = helpers.feed -local api = helpers.api -local exec_capture = helpers.exec_capture +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local dedent = t.dedent +local eval = t.eval +local eq = t.eq +local feed = t.feed +local api = t.api +local exec_capture = t.exec_capture describe('TabNewEntered', function() describe('au TabNewEntered', function() diff --git a/test/functional/autocmd/termxx_spec.lua b/test/functional/autocmd/termxx_spec.lua index 982edfa06a..99af3aed3e 100644 --- a/test/functional/autocmd/termxx_spec.lua +++ b/test/functional/autocmd/termxx_spec.lua @@ -1,17 +1,17 @@ local uv = vim.uv -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') - -local clear, command, testprg = helpers.clear, helpers.command, helpers.testprg -local eval, eq, neq, retry = helpers.eval, helpers.eq, helpers.neq, helpers.retry -local matches = helpers.matches -local ok = helpers.ok -local feed = helpers.feed -local api = helpers.api -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive -local skip = helpers.skip -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') + +local clear, command, testprg = t.clear, t.command, t.testprg +local eval, eq, neq, retry = t.eval, t.eq, t.neq, t.retry +local matches = t.matches +local ok = t.ok +local feed = t.feed +local api = t.api +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive +local skip = t.skip +local is_os = t.is_os describe('autocmd TermClose', function() before_each(function() @@ -198,11 +198,11 @@ end) describe('autocmd TextChangedT', function() clear() - local screen = thelpers.screen_setup() + local screen = tt.screen_setup() it('works', function() command('autocmd TextChangedT * ++once let g:called = 1') - thelpers.feed_data('a') + tt.feed_data('a') retry(nil, nil, function() eq(1, api.nvim_get_var('called')) end) @@ -210,7 +210,7 @@ describe('autocmd TextChangedT', function() it('cannot delete terminal buffer', function() command([[autocmd TextChangedT * call nvim_input('<CR>') | bwipe!]]) - thelpers.feed_data('a') + tt.feed_data('a') screen:expect({ any = 'E937: ' }) matches( '^E937: Attempt to delete a buffer that is in use: term://', diff --git a/test/functional/autocmd/textchanged_spec.lua b/test/functional/autocmd/textchanged_spec.lua index 381984249d..b964b9c7cd 100644 --- a/test/functional/autocmd/textchanged_spec.lua +++ b/test/functional/autocmd/textchanged_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec = helpers.exec -local command = helpers.command -local feed = helpers.feed -local eq = helpers.eq -local neq = helpers.neq -local eval = helpers.eval -local poke_eventloop = helpers.poke_eventloop -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec = t.exec +local command = t.command +local feed = t.feed +local eq = t.eq +local neq = t.neq +local eval = t.eval +local poke_eventloop = t.poke_eventloop +local write_file = t.write_file -- oldtest: Test_ChangedP() it('TextChangedI and TextChangedP autocommands', function() diff --git a/test/functional/autocmd/textyankpost_spec.lua b/test/functional/autocmd/textyankpost_spec.lua index 17eb7695f2..45b1510b2e 100644 --- a/test/functional/autocmd/textyankpost_spec.lua +++ b/test/functional/autocmd/textyankpost_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq -local feed, command, expect = helpers.feed, helpers.command, helpers.expect -local api, fn, neq = helpers.api, helpers.fn, helpers.neq +local t = require('test.functional.testutil')(after_each) +local clear, eval, eq = t.clear, t.eval, t.eq +local feed, command, expect = t.feed, t.command, t.expect +local api, fn, neq = t.api, t.fn, t.neq describe('TextYankPost', function() before_each(function() diff --git a/test/functional/autocmd/win_scrolled_resized_spec.lua b/test/functional/autocmd/win_scrolled_resized_spec.lua index d40dc37103..9405c083ff 100644 --- a/test/functional/autocmd/win_scrolled_resized_spec.lua +++ b/test/functional/autocmd/win_scrolled_resized_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local exec = helpers.exec -local command = helpers.command -local feed = helpers.feed -local api = helpers.api -local assert_alive = helpers.assert_alive +local clear = t.clear +local eq = t.eq +local eval = t.eval +local exec = t.exec +local command = t.command +local feed = t.feed +local api = t.api +local assert_alive = t.assert_alive before_each(clear) diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua index 0ab885e02f..24a295093a 100644 --- a/test/functional/core/channels_spec.lua +++ b/test/functional/core/channels_spec.lua @@ -1,18 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, eval, next_msg, ok, source = - helpers.clear, helpers.eq, helpers.eval, helpers.next_msg, helpers.ok, helpers.source -local command, fn, api = helpers.command, helpers.fn, helpers.api -local matches = helpers.matches +local t = require('test.functional.testutil')(after_each) +local clear, eq, eval, next_msg, ok, source = t.clear, t.eq, t.eval, t.next_msg, t.ok, t.source +local command, fn, api = t.command, t.fn, t.api +local matches = t.matches local sleep = vim.uv.sleep -local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv -local get_session, set_session = helpers.get_session, helpers.set_session -local nvim_prog = helpers.nvim_prog -local is_os = helpers.is_os -local retry = helpers.retry -local expect_twostreams = helpers.expect_twostreams -local assert_alive = helpers.assert_alive -local pcall_err = helpers.pcall_err -local skip = helpers.skip +local spawn, nvim_argv = t.spawn, t.nvim_argv +local get_session, set_session = t.get_session, t.set_session +local nvim_prog = t.nvim_prog +local is_os = t.is_os +local retry = t.retry +local expect_twostreams = t.expect_twostreams +local assert_alive = t.assert_alive +local pcall_err = t.pcall_err +local skip = t.skip describe('channels', function() local init = [[ diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua index d9e3cc3f31..058d67dba1 100644 --- a/test/functional/core/exit_spec.lua +++ b/test/functional/core/exit_spec.lua @@ -1,24 +1,24 @@ -local helpers = require('test.functional.helpers')(after_each) - -local assert_alive = helpers.assert_alive -local command = helpers.command -local feed_command = helpers.feed_command -local feed = helpers.feed -local eval = helpers.eval -local eq = helpers.eq -local run = helpers.run -local fn = helpers.fn -local nvim_prog = helpers.nvim_prog -local pcall_err = helpers.pcall_err -local exec_capture = helpers.exec_capture -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) + +local assert_alive = t.assert_alive +local command = t.command +local feed_command = t.feed_command +local feed = t.feed +local eval = t.eval +local eq = t.eq +local run = t.run +local fn = t.fn +local nvim_prog = t.nvim_prog +local pcall_err = t.pcall_err +local exec_capture = t.exec_capture +local poke_eventloop = t.poke_eventloop describe('v:exiting', function() local cid before_each(function() - helpers.clear() - cid = helpers.api.nvim_get_chan_info(0).id + t.clear() + cid = t.api.nvim_get_chan_info(0).id end) it('defaults to v:null', function() @@ -74,7 +74,7 @@ describe(':cquit', function() end before_each(function() - helpers.clear() + t.clear() end) it('exits with non-zero after :cquit', function() diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua index 928cab525c..4b1018b0f0 100644 --- a/test/functional/core/fileio_spec.lua +++ b/test/functional/core/fileio_spec.lua @@ -1,37 +1,37 @@ local uv = vim.uv -local helpers = require('test.functional.helpers')(after_each) - -local assert_log = helpers.assert_log -local assert_nolog = helpers.assert_nolog -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local neq = helpers.neq -local ok = helpers.ok -local feed = helpers.feed -local fn = helpers.fn -local nvim_prog = helpers.nvim_prog -local request = helpers.request -local retry = helpers.retry -local rmdir = helpers.rmdir -local matches = helpers.matches -local api = helpers.api -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) + +local assert_log = t.assert_log +local assert_nolog = t.assert_nolog +local clear = t.clear +local command = t.command +local eq = t.eq +local neq = t.neq +local ok = t.ok +local feed = t.feed +local fn = t.fn +local nvim_prog = t.nvim_prog +local request = t.request +local retry = t.retry +local rmdir = t.rmdir +local matches = t.matches +local api = t.api +local mkdir = t.mkdir local sleep = vim.uv.sleep -local read_file = helpers.read_file +local read_file = t.read_file local trim = vim.trim -local currentdir = helpers.fn.getcwd -local assert_alive = helpers.assert_alive -local check_close = helpers.check_close -local expect_exit = helpers.expect_exit -local write_file = helpers.write_file +local currentdir = t.fn.getcwd +local assert_alive = t.assert_alive +local check_close = t.check_close +local expect_exit = t.expect_exit +local write_file = t.write_file local Screen = require('test.functional.ui.screen') -local feed_command = helpers.feed_command -local skip = helpers.skip -local is_os = helpers.is_os -local is_ci = helpers.is_ci -local spawn = helpers.spawn -local set_session = helpers.set_session +local feed_command = t.feed_command +local skip = t.skip +local is_os = t.is_os +local is_ci = t.is_ci +local spawn = t.spawn +local set_session = t.set_session describe('fileio', function() before_each(function() end) @@ -228,7 +228,7 @@ describe('fileio', function() local initial_content = 'foo' local backup_dir = 'Xtest_backupdir' - local sep = helpers.get_pathsep() + local sep = t.get_pathsep() local link_file_name = 'Xtest_startup_file2' local backup_file_name = backup_dir .. sep .. link_file_name .. '~' @@ -329,7 +329,7 @@ describe('tmpdir', function() before_each(function() -- Fake /tmp dir so that we can mess it up. - os_tmpdir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX') + os_tmpdir = vim.uv.fs_mkdtemp(vim.fs.dirname(t.tmpname()) .. '/nvim_XXXXXXXXXX') end) after_each(function() diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index f0e61fbcc1..17264d80a5 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -1,40 +1,40 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') - -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local exc_exec = helpers.exc_exec -local feed_command = helpers.feed_command -local feed = helpers.feed -local insert = helpers.insert -local neq = helpers.neq -local next_msg = helpers.next_msg -local testprg = helpers.testprg -local ok = helpers.ok -local source = helpers.source -local write_file = helpers.write_file -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local assert_alive = helpers.assert_alive -local command = helpers.command -local fn = helpers.fn -local os_kill = helpers.os_kill -local retry = helpers.retry -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') + +local clear = t.clear +local eq = t.eq +local eval = t.eval +local exc_exec = t.exc_exec +local feed_command = t.feed_command +local feed = t.feed +local insert = t.insert +local neq = t.neq +local next_msg = t.next_msg +local testprg = t.testprg +local ok = t.ok +local source = t.source +local write_file = t.write_file +local mkdir = t.mkdir +local rmdir = t.rmdir +local assert_alive = t.assert_alive +local command = t.command +local fn = t.fn +local os_kill = t.os_kill +local retry = t.retry +local api = t.api local NIL = vim.NIL -local poke_eventloop = helpers.poke_eventloop -local get_pathsep = helpers.get_pathsep -local pathroot = helpers.pathroot -local exec_lua = helpers.exec_lua -local nvim_set = helpers.nvim_set -local expect_twostreams = helpers.expect_twostreams -local expect_msg_seq = helpers.expect_msg_seq -local pcall_err = helpers.pcall_err -local matches = helpers.matches +local poke_eventloop = t.poke_eventloop +local get_pathsep = t.get_pathsep +local pathroot = t.pathroot +local exec_lua = t.exec_lua +local nvim_set = t.nvim_set +local expect_twostreams = t.expect_twostreams +local expect_msg_seq = t.expect_msg_seq +local pcall_err = t.pcall_err +local matches = t.matches local Screen = require('test.functional.ui.screen') -local skip = helpers.skip -local is_os = helpers.is_os +local skip = t.skip +local is_os = t.is_os describe('jobs', function() local channel @@ -307,7 +307,7 @@ describe('jobs', function() it('preserves NULs', function() -- Make a file with NULs in it. - local filename = helpers.tmpname() + local filename = t.tmpname() write_file(filename, 'abc\0def\n') command("let j = jobstart(['cat', '" .. filename .. "'], g:job_opts)") @@ -732,7 +732,7 @@ describe('jobs', function() describe('jobwait()', function() before_each(function() if is_os('win') then - helpers.set_shell_powershell() + t.set_shell_powershell() end end) @@ -1182,7 +1182,7 @@ describe('jobs', function() end) it('does not close the same handle twice on exit #25086', function() - local filename = string.format('%s.lua', helpers.tmpname()) + local filename = string.format('%s.lua', t.tmpname()) write_file( filename, [[ @@ -1195,7 +1195,7 @@ describe('jobs', function() ]] ) - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '--cmd', 'set notermguicolors', '-i', @@ -1239,7 +1239,7 @@ describe('pty process teardown', function() skip(fn.executable('sleep') == 0, 'missing "sleep" command') -- Use a nested nvim (in :term) to test without --headless. fn.termopen({ - helpers.nvim_prog, + t.nvim_prog, '-u', 'NONE', '-i', diff --git a/test/functional/core/log_spec.lua b/test/functional/core/log_spec.lua index 1637e683c1..dfacc0af6e 100644 --- a/test/functional/core/log_spec.lua +++ b/test/functional/core/log_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_log = helpers.assert_log -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local expect_exit = helpers.expect_exit -local request = helpers.request +local t = require('test.functional.testutil')(after_each) +local assert_log = t.assert_log +local clear = t.clear +local command = t.command +local eq = t.eq +local exec_lua = t.exec_lua +local expect_exit = t.expect_exit +local request = t.request describe('log', function() local testlog = 'Xtest_logging' diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index 396ec2c79e..ee3e32d794 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -1,17 +1,17 @@ local uv = vim.uv -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local matches = helpers.matches -local feed = helpers.feed -local eval = helpers.eval -local clear = helpers.clear -local fn = helpers.fn -local nvim_prog_abs = helpers.nvim_prog_abs -local write_file = helpers.write_file -local is_os = helpers.is_os -local skip = helpers.skip +local eq = t.eq +local matches = t.matches +local feed = t.feed +local eval = t.eval +local clear = t.clear +local fn = t.fn +local nvim_prog_abs = t.nvim_prog_abs +local write_file = t.write_file +local is_os = t.is_os +local skip = t.skip describe('command-line option', function() describe('-s', function() diff --git a/test/functional/core/path_spec.lua b/test/functional/core/path_spec.lua index e98bfc0d45..65eaa201d9 100644 --- a/test/functional/core/path_spec.lua +++ b/test/functional/core/path_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local fn = helpers.fn -local insert = helpers.insert -local is_os = helpers.is_os -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed +local fn = t.fn +local insert = t.insert +local is_os = t.is_os +local mkdir = t.mkdir +local rmdir = t.rmdir +local write_file = t.write_file local function join_path(...) local pathsep = (is_os('win') and '\\' or '/') diff --git a/test/functional/core/remote_spec.lua b/test/functional/core/remote_spec.lua index caff06f6ab..5c8a86091d 100644 --- a/test/functional/core/remote_spec.lua +++ b/test/functional/core/remote_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local exec_capture = helpers.exec_capture -local exec_lua = helpers.exec_lua -local expect = helpers.expect -local fn = helpers.fn -local insert = helpers.insert -local nvim_prog = helpers.nvim_prog -local new_argv = helpers.new_argv -local neq = helpers.neq -local set_session = helpers.set_session -local spawn = helpers.spawn -local tmpname = helpers.tmpname -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local eq = t.eq +local exec_capture = t.exec_capture +local exec_lua = t.exec_lua +local expect = t.expect +local fn = t.fn +local insert = t.insert +local nvim_prog = t.nvim_prog +local new_argv = t.new_argv +local neq = t.neq +local set_session = t.set_session +local spawn = t.spawn +local tmpname = t.tmpname +local write_file = t.write_file describe('Remote', function() local fname, other_fname diff --git a/test/functional/core/spellfile_spec.lua b/test/functional/core/spellfile_spec.lua index 57953b8f80..ac3f1b27a6 100644 --- a/test/functional/core/spellfile_spec.lua +++ b/test/functional/core/spellfile_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local api = helpers.api -local exc_exec = helpers.exc_exec -local fn = helpers.fn -local rmdir = helpers.rmdir -local write_file = helpers.write_file -local mkdir = helpers.mkdir +local eq = t.eq +local clear = t.clear +local api = t.api +local exc_exec = t.exc_exec +local fn = t.fn +local rmdir = t.rmdir +local write_file = t.write_file +local mkdir = t.mkdir local testdir = 'Xtest-functional-spell-spellfile.d' diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index bd3db02874..31e4805d76 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -1,38 +1,38 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local assert_log = helpers.assert_log -local clear = helpers.clear -local command = helpers.command -local ok = helpers.ok -local eq = helpers.eq -local matches = helpers.matches -local eval = helpers.eval -local exec = helpers.exec -local exec_capture = helpers.exec_capture -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local fn = helpers.fn +local assert_alive = t.assert_alive +local assert_log = t.assert_log +local clear = t.clear +local command = t.command +local ok = t.ok +local eq = t.eq +local matches = t.matches +local eval = t.eval +local exec = t.exec +local exec_capture = t.exec_capture +local exec_lua = t.exec_lua +local feed = t.feed +local fn = t.fn local pesc = vim.pesc -local mkdir = helpers.mkdir -local mkdir_p = helpers.mkdir_p -local nvim_prog = helpers.nvim_prog -local nvim_set = helpers.nvim_set -local read_file = helpers.read_file -local retry = helpers.retry -local rmdir = helpers.rmdir +local mkdir = t.mkdir +local mkdir_p = t.mkdir_p +local nvim_prog = t.nvim_prog +local nvim_set = t.nvim_set +local read_file = t.read_file +local retry = t.retry +local rmdir = t.rmdir local sleep = vim.uv.sleep local startswith = vim.startswith -local write_file = helpers.write_file -local api = helpers.api -local alter_slashes = helpers.alter_slashes -local is_os = helpers.is_os -local dedent = helpers.dedent +local write_file = t.write_file +local api = t.api +local alter_slashes = t.alter_slashes +local is_os = t.is_os +local dedent = t.dedent local tbl_map = vim.tbl_map local tbl_filter = vim.tbl_filter local endswith = vim.endswith -local check_close = helpers.check_close +local check_close = t.check_close local testlog = 'Xtest-startupspec-log' @@ -467,7 +467,7 @@ describe('startup', function() | ]]) if not is_os('win') then - assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog) + assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog, 100) end end) @@ -994,7 +994,7 @@ describe('sysinit', function() local xdgdir = 'Xxdg' local vimdir = 'Xvim' local xhome = 'Xhome' - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() before_each(function() rmdir(xdgdir) @@ -1055,7 +1055,7 @@ end) describe('user config init', function() local xhome = 'Xhome' - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() local xconfig = xhome .. pathsep .. 'Xconfig' local xdata = xhome .. pathsep .. 'Xdata' local init_lua_path = table.concat({ xconfig, 'nvim', 'init.lua' }, pathsep) @@ -1218,7 +1218,7 @@ end) describe('runtime:', function() local xhome = 'Xhome' - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() local xconfig = xhome .. pathsep .. 'Xconfig' local xdata = xhome .. pathsep .. 'Xdata' local xenv = { XDG_CONFIG_HOME = xconfig, XDG_DATA_HOME = xdata } @@ -1360,7 +1360,7 @@ end) describe('user session', function() local xhome = 'Xhome' - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() local session_file = table.concat({ xhome, 'session.lua' }, pathsep) before_each(function() diff --git a/test/functional/editor/K_spec.lua b/test/functional/editor/K_spec.lua index 1fbdd1c142..9feb878378 100644 --- a/test/functional/editor/K_spec.lua +++ b/test/functional/editor/K_spec.lua @@ -1,6 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, clear, eval, feed, api, retry = - helpers.eq, helpers.clear, helpers.eval, helpers.feed, helpers.api, helpers.retry +local t = require('test.functional.testutil')(after_each) +local eq, clear, eval, feed, api, retry = t.eq, t.clear, t.eval, t.feed, t.api, t.retry describe('K', function() local test_file = 'K_spec_out' @@ -13,19 +12,19 @@ describe('K', function() end) it("invokes colon-prefixed 'keywordprg' as Vim command", function() - helpers.source([[ + t.source([[ let @a='fnord' set keywordprg=:put]]) -- K on the text "a" resolves to `:put a`. feed('ia<ESC>K') - helpers.expect([[ + t.expect([[ a fnord]]) end) it("invokes non-prefixed 'keywordprg' as shell command", function() - helpers.source([[ + t.source([[ let @a='fnord' set keywordprg=echo\ fnord>>]]) @@ -43,7 +42,7 @@ describe('K', function() end) it("<esc> kills the buffer for a running 'keywordprg' command", function() - helpers.source('set keywordprg=less') + t.source('set keywordprg=less') eval('writefile(["hello", "world"], "' .. test_file .. '")') feed('i' .. test_file .. '<esc>K') eq('t', eval('mode()')) @@ -57,7 +56,7 @@ describe('K', function() local bufnr = eval('bufnr()') feed('<esc>') eq('n', eval('mode()')) - helpers.neq(bufnr, eval('bufnr()')) + t.neq(bufnr, eval('bufnr()')) end) it('empty string falls back to :help #19298', function() diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index 33d0d47499..45cfb062ad 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local clear, feed = helpers.clear, helpers.feed -local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq -local feed_command, source, expect = helpers.feed_command, helpers.source, helpers.expect -local fn = helpers.fn -local command = helpers.command -local api = helpers.api -local poke_eventloop = helpers.poke_eventloop +local assert_alive = t.assert_alive +local clear, feed = t.clear, t.feed +local eval, eq, neq = t.eval, t.eq, t.neq +local feed_command, source, expect = t.feed_command, t.source, t.expect +local fn = t.fn +local command = t.command +local api = t.api +local poke_eventloop = t.poke_eventloop describe('completion', function() local screen diff --git a/test/functional/editor/count_spec.lua b/test/functional/editor/count_spec.lua index 94f741250a..808460520b 100644 --- a/test/functional/editor/count_spec.lua +++ b/test/functional/editor/count_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local clear = helpers.clear -local command = helpers.command +local eq = t.eq +local eval = t.eval +local feed = t.feed +local clear = t.clear +local command = t.command describe('v:count/v:count1', function() before_each(function() diff --git a/test/functional/editor/ctrl_c_spec.lua b/test/functional/editor/ctrl_c_spec.lua index f5eb98cc8d..ff12f5db0d 100644 --- a/test/functional/editor/ctrl_c_spec.lua +++ b/test/functional/editor/ctrl_c_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, source = helpers.clear, helpers.feed, helpers.source -local command = helpers.command -local poke_eventloop = helpers.poke_eventloop +local clear, feed, source = t.clear, t.feed, t.source +local command = t.command +local poke_eventloop = t.poke_eventloop local sleep = vim.uv.sleep describe('CTRL-C (mapped)', function() @@ -16,7 +16,7 @@ describe('CTRL-C (mapped)', function() it('interrupts :global', function() -- Crashes luajit. - if helpers.skip_fragile(pending) then + if t.skip_fragile(pending) then return end diff --git a/test/functional/editor/fold_spec.lua b/test/functional/editor/fold_spec.lua index 7950f6aea4..e0c986f55f 100644 --- a/test/functional/editor/fold_spec.lua +++ b/test/functional/editor/fold_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local insert = helpers.insert -local exec = helpers.exec -local feed = helpers.feed -local expect = helpers.expect -local command = helpers.command -local fn = helpers.fn -local eq = helpers.eq -local neq = helpers.neq +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local insert = t.insert +local exec = t.exec +local feed = t.feed +local expect = t.expect +local command = t.command +local fn = t.fn +local eq = t.eq +local neq = t.neq describe('Folding', function() local tempfname = 'Xtest-fold.txt' @@ -301,7 +301,7 @@ a]], it('updates correctly on :read', function() -- luacheck: ignore 621 - helpers.write_file( + t.write_file( tempfname, [[ a @@ -376,7 +376,7 @@ a]], end) it('splits folds according to >N and <N with foldexpr', function() - helpers.source([[ + t.source([[ function TestFoldExpr(lnum) let thisline = getline(a:lnum) if thisline == 'a' @@ -391,7 +391,7 @@ a]], return 0 endfunction ]]) - helpers.write_file( + t.write_file( tempfname, [[ b diff --git a/test/functional/editor/jump_spec.lua b/test/functional/editor/jump_spec.lua index fe03d82164..ad064091d8 100644 --- a/test/functional/editor/jump_spec.lua +++ b/test/functional/editor/jump_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local dedent = helpers.dedent -local eq = helpers.eq -local fn = helpers.fn -local feed = helpers.feed -local exec_capture = helpers.exec_capture -local write_file = helpers.write_file -local api = helpers.api +local clear = t.clear +local command = t.command +local dedent = t.dedent +local eq = t.eq +local fn = t.fn +local feed = t.feed +local exec_capture = t.exec_capture +local write_file = t.write_file +local api = t.api describe('jumplist', function() local fname1 = 'Xtest-functional-normal-jump' diff --git a/test/functional/editor/lang_spec.lua b/test/functional/editor/lang_spec.lua index ee7cfac057..b7154a27f8 100644 --- a/test/functional/editor/lang_spec.lua +++ b/test/functional/editor/lang_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, insert, eq = helpers.clear, helpers.insert, helpers.eq -local command, expect = helpers.command, helpers.expect -local feed, eval = helpers.feed, helpers.eval -local exc_exec = helpers.exc_exec +local t = require('test.functional.testutil')(after_each) +local clear, insert, eq = t.clear, t.insert, t.eq +local command, expect = t.command, t.expect +local feed, eval = t.feed, t.eval +local exc_exec = t.exc_exec describe('gu and gU', function() before_each(clear) diff --git a/test/functional/editor/langmap_spec.lua b/test/functional/editor/langmap_spec.lua index b2a4b21a89..b569b70925 100644 --- a/test/functional/editor/langmap_spec.lua +++ b/test/functional/editor/langmap_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq, neq, call = helpers.eq, helpers.neq, helpers.call -local eval, feed, clear = helpers.eval, helpers.feed, helpers.clear -local command, insert, expect = helpers.command, helpers.insert, helpers.expect -local feed_command = helpers.feed_command -local curwin = helpers.api.nvim_get_current_win +local eq, neq, call = t.eq, t.neq, t.call +local eval, feed, clear = t.eval, t.feed, t.clear +local command, insert, expect = t.command, t.insert, t.expect +local feed_command = t.feed_command +local curwin = t.api.nvim_get_current_win describe("'langmap'", function() before_each(function() @@ -133,7 +133,7 @@ describe("'langmap'", function() hello]]) end) it('command-line CTRL-R', function() - helpers.source([[ + t.source([[ let i_value = 0 let j_value = 0 call setreg('i', 'i_value') @@ -171,7 +171,7 @@ describe("'langmap'", function() end) it('prompt for number', function() command('set langmap=12,21') - helpers.source([[ + t.source([[ let gotten_one = 0 function Map() let answer = inputlist(['a', '1.', '2.', '3.']) @@ -214,10 +214,7 @@ describe("'langmap'", function() end feed('qa' .. command_string .. 'q') expect(expect_string) - eq( - expect_macro or helpers.fn.nvim_replace_termcodes(command_string, true, true, true), - eval('@a') - ) + eq(expect_macro or t.fn.nvim_replace_termcodes(command_string, true, true, true), eval('@a')) if setup_function then setup_function() end diff --git a/test/functional/editor/macro_spec.lua b/test/functional/editor/macro_spec.lua index c97befdf07..86e7b8f3c8 100644 --- a/test/functional/editor/macro_spec.lua +++ b/test/functional/editor/macro_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) - -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local clear = helpers.clear -local expect = helpers.expect -local command = helpers.command -local fn = helpers.fn -local api = helpers.api -local insert = helpers.insert +local t = require('test.functional.testutil')(after_each) + +local eq = t.eq +local eval = t.eval +local feed = t.feed +local clear = t.clear +local expect = t.expect +local command = t.command +local fn = t.fn +local api = t.api +local insert = t.insert describe('macros', function() before_each(function() diff --git a/test/functional/editor/mark_spec.lua b/test/functional/editor/mark_spec.lua index 625490ef83..ad45edd500 100644 --- a/test/functional/editor/mark_spec.lua +++ b/test/functional/editor/mark_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local api = helpers.api -local clear = helpers.clear -local command = helpers.command -local fn = helpers.fn -local eq = helpers.eq -local feed = helpers.feed -local write_file = helpers.write_file -local pcall_err = helpers.pcall_err +local api = t.api +local clear = t.clear +local command = t.command +local fn = t.fn +local eq = t.eq +local feed = t.feed +local write_file = t.write_file +local pcall_err = t.pcall_err local cursor = function() - return helpers.api.nvim_win_get_cursor(0) + return t.api.nvim_win_get_cursor(0) end describe('named marks', function() @@ -39,59 +39,59 @@ describe('named marks', function() it('errors when set out of range with :mark', function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, '1000mark x') + local err = pcall_err(t.exec_capture, '1000mark x') eq('nvim_exec2(): Vim(mark):E16: Invalid range: 1000mark x', err) end) it('errors when set out of range with :k', function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, '1000kx') + local err = pcall_err(t.exec_capture, '1000kx') eq('nvim_exec2(): Vim(k):E16: Invalid range: 1000kx', err) end) it('errors on unknown mark name with :mark', function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, 'mark #') + local err = pcall_err(t.exec_capture, 'mark #') eq('nvim_exec2(): Vim(mark):E191: Argument must be a letter or forward/backward quote', err) end) it("errors on unknown mark name with '", function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, "normal! '#") + local err = pcall_err(t.exec_capture, "normal! '#") eq('nvim_exec2(): Vim(normal):E78: Unknown mark', err) end) it('errors on unknown mark name with `', function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, 'normal! `#') + local err = pcall_err(t.exec_capture, 'normal! `#') eq('nvim_exec2(): Vim(normal):E78: Unknown mark', err) end) it("errors when moving to a mark that is not set with '", function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, "normal! 'z") + local err = pcall_err(t.exec_capture, "normal! 'z") eq('nvim_exec2(): Vim(normal):E20: Mark not set', err) - err = pcall_err(helpers.exec_capture, "normal! '.") + err = pcall_err(t.exec_capture, "normal! '.") eq('nvim_exec2(): Vim(normal):E20: Mark not set', err) end) it('errors when moving to a mark that is not set with `', function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, 'normal! `z') + local err = pcall_err(t.exec_capture, 'normal! `z') eq('nvim_exec2(): Vim(normal):E20: Mark not set', err) - err = pcall_err(helpers.exec_capture, 'normal! `>') + err = pcall_err(t.exec_capture, 'normal! `>') eq('nvim_exec2(): Vim(normal):E20: Mark not set', err) end) it("errors when moving to a global mark that is not set with '", function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, "normal! 'Z") + local err = pcall_err(t.exec_capture, "normal! 'Z") eq('nvim_exec2(): Vim(normal):E20: Mark not set', err) end) it('errors when moving to a global mark that is not set with `', function() command('edit ' .. file1) - local err = pcall_err(helpers.exec_capture, 'normal! `Z') + local err = pcall_err(t.exec_capture, 'normal! `Z') eq('nvim_exec2(): Vim(normal):E20: Mark not set', err) end) @@ -166,7 +166,7 @@ describe('named marks', function() feed('mA') command('next') command('bw! ' .. file1) - local err = pcall_err(helpers.exec_capture, "normal! 'A") + local err = pcall_err(t.exec_capture, "normal! 'A") eq('nvim_exec2(): Vim(normal):E92: Buffer 1 not found', err) os.remove(file1) end) diff --git a/test/functional/editor/meta_key_spec.lua b/test/functional/editor/meta_key_spec.lua index e2bdf6ba96..97acb3d090 100644 --- a/test/functional/editor/meta_key_spec.lua +++ b/test/functional/editor/meta_key_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command = helpers.command -local exec_lua = helpers.exec_lua -local eval = helpers.eval -local expect = helpers.expect -local fn = helpers.fn -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local command = t.command +local exec_lua = t.exec_lua +local eval = t.eval +local expect = t.expect +local fn = t.fn +local eq = t.eq describe('meta-keys #8226 #13042', function() before_each(function() diff --git a/test/functional/editor/mode_cmdline_spec.lua b/test/functional/editor/mode_cmdline_spec.lua index 06efe53718..6347c0f063 100644 --- a/test/functional/editor/mode_cmdline_spec.lua +++ b/test/functional/editor/mode_cmdline_spec.lua @@ -1,12 +1,11 @@ -- Cmdline-mode tests. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, insert, fn, eq, feed = - helpers.clear, helpers.insert, helpers.fn, helpers.eq, helpers.feed -local eval = helpers.eval -local command = helpers.command -local api = helpers.api +local clear, insert, fn, eq, feed = t.clear, t.insert, t.fn, t.eq, t.feed +local eval = t.eval +local command = t.command +local api = t.api describe('cmdline', function() before_each(clear) diff --git a/test/functional/editor/mode_insert_spec.lua b/test/functional/editor/mode_insert_spec.lua index ebf118736f..1323260257 100644 --- a/test/functional/editor/mode_insert_spec.lua +++ b/test/functional/editor/mode_insert_spec.lua @@ -1,14 +1,14 @@ -- Insert-mode tests. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local expect = helpers.expect -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local curbuf_contents = helpers.curbuf_contents -local api = helpers.api +local clear, feed, insert = t.clear, t.feed, t.insert +local expect = t.expect +local command = t.command +local eq = t.eq +local eval = t.eval +local curbuf_contents = t.curbuf_contents +local api = t.api describe('insert-mode', function() before_each(function() @@ -232,10 +232,10 @@ describe('insert-mode', function() end local function test_cols(expected_cols) - local cols = { { helpers.fn.col('.'), helpers.fn.virtcol('.') } } + local cols = { { t.fn.col('.'), t.fn.virtcol('.') } } for _ = 2, #expected_cols do feed('<BS>') - table.insert(cols, { helpers.fn.col('.'), helpers.fn.virtcol('.') }) + table.insert(cols, { t.fn.col('.'), t.fn.virtcol('.') }) end eq(expected_cols, cols) end diff --git a/test/functional/editor/mode_normal_spec.lua b/test/functional/editor/mode_normal_spec.lua index 89bab3f6c9..fcc13782e5 100644 --- a/test/functional/editor/mode_normal_spec.lua +++ b/test/functional/editor/mode_normal_spec.lua @@ -1,11 +1,11 @@ -- Normal mode tests. -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local feed = helpers.feed -local fn = helpers.fn -local command = helpers.command -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local feed = t.feed +local fn = t.fn +local command = t.command +local eq = t.eq describe('Normal mode', function() before_each(clear) diff --git a/test/functional/editor/put_spec.lua b/test/functional/editor/put_spec.lua index 414b289222..96a1d87b8b 100644 --- a/test/functional/editor/put_spec.lua +++ b/test/functional/editor/put_spec.lua @@ -1,18 +1,18 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local insert = helpers.insert -local feed = helpers.feed -local expect = helpers.expect -local eq = helpers.eq +local clear = t.clear +local insert = t.insert +local feed = t.feed +local expect = t.expect +local eq = t.eq local map = vim.tbl_map local filter = vim.tbl_filter -local feed_command = helpers.feed_command -local command = helpers.command -local curbuf_contents = helpers.curbuf_contents -local fn = helpers.fn -local dedent = helpers.dedent +local feed_command = t.feed_command +local command = t.command +local curbuf_contents = t.curbuf_contents +local fn = t.fn +local dedent = t.dedent local function reset() command('bwipe! | new') @@ -75,7 +75,7 @@ describe('put command', function() extra_setup() end local orig_dotstr = fn.getreg('.') - helpers.ok(visual_marks_zero()) + t.ok(visual_marks_zero()) -- Make sure every test starts from the same conditions assert_no_change(test.exception_table, false) local was_cli = test.test_action() @@ -890,7 +890,7 @@ describe('put command', function() -- check bell is not set by nvim before the action screen:sleep(50) end - helpers.ok(not screen.bell and not screen.visualbell) + t.ok(not screen.bell and not screen.visualbell) actions() screen:expect { condition = function() diff --git a/test/functional/editor/search_spec.lua b/test/functional/editor/search_spec.lua index 46a3e298b7..2ccbcc8865 100644 --- a/test/functional/editor/search_spec.lua +++ b/test/functional/editor/search_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local pcall_err = t.pcall_err describe('search (/)', function() before_each(clear) diff --git a/test/functional/editor/tabpage_spec.lua b/test/functional/editor/tabpage_spec.lua index 0cbc2dbf3d..e77e30f9e0 100644 --- a/test/functional/editor/tabpage_spec.lua +++ b/test/functional/editor/tabpage_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local neq = helpers.neq -local feed = helpers.feed -local eval = helpers.eval -local exec = helpers.exec -local fn = helpers.fn -local api = helpers.api -local curwin = helpers.api.nvim_get_current_win -local assert_alive = helpers.assert_alive +local clear = t.clear +local command = t.command +local eq = t.eq +local neq = t.neq +local feed = t.feed +local eval = t.eval +local exec = t.exec +local fn = t.fn +local api = t.api +local curwin = t.api.nvim_get_current_win +local assert_alive = t.assert_alive describe('tabpage', function() before_each(clear) diff --git a/test/functional/editor/undo_spec.lua b/test/functional/editor/undo_spec.lua index c101bf02a0..f6dd07054b 100644 --- a/test/functional/editor/undo_spec.lua +++ b/test/functional/editor/undo_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local command = helpers.command -local eval = helpers.eval -local expect = helpers.expect -local eq = helpers.eq -local feed = helpers.feed -local feed_command = helpers.feed_command -local insert = helpers.insert -local fn = helpers.fn -local exec = helpers.exec -local exec_lua = helpers.exec_lua +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local command = t.command +local eval = t.eval +local expect = t.expect +local eq = t.eq +local feed = t.feed +local feed_command = t.feed_command +local insert = t.insert +local fn = t.fn +local exec = t.exec +local exec_lua = t.exec_lua local function lastmessage() local messages = fn.split(fn.execute('messages'), '\n') @@ -44,7 +44,7 @@ describe('u CTRL-R g- g+', function() local function undo_and_redo(hist_pos, undo, redo, expect_str) command('enew!') create_history(hist_pos) - local cur_contents = helpers.curbuf_contents() + local cur_contents = t.curbuf_contents() feed(undo) expect(expect_str) feed(redo) diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua index 5eb8d49c74..5069568b98 100644 --- a/test/functional/ex_cmds/append_spec.lua +++ b/test/functional/ex_cmds/append_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local dedent = helpers.dedent -local exec = helpers.exec -local feed = helpers.feed -local clear = helpers.clear -local fn = helpers.fn -local command = helpers.command -local api = helpers.api +local eq = t.eq +local dedent = t.dedent +local exec = t.exec +local feed = t.feed +local clear = t.clear +local fn = t.fn +local command = t.command +local api = t.api local Screen = require('test.functional.ui.screen') local cmdtest = function(cmd, prep, ret1) diff --git a/test/functional/ex_cmds/arg_spec.lua b/test/functional/ex_cmds/arg_spec.lua index 45b2f50af1..3c12c535dd 100644 --- a/test/functional/ex_cmds/arg_spec.lua +++ b/test/functional/ex_cmds/arg_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, command, fn = helpers.eq, helpers.command, helpers.fn -local ok = helpers.ok -local matches = helpers.matches -local clear = helpers.clear +local t = require('test.functional.testutil')(after_each) +local eq, command, fn = t.eq, t.command, t.fn +local ok = t.ok +local matches = t.matches +local clear = t.clear describe(':argument', function() before_each(function() @@ -11,19 +11,19 @@ describe(':argument', function() it('does not restart :terminal buffer', function() command('terminal') - helpers.feed([[<C-\><C-N>]]) + t.feed([[<C-\><C-N>]]) command('argadd') - helpers.feed([[<C-\><C-N>]]) + t.feed([[<C-\><C-N>]]) local bufname_before = fn.bufname('%') local bufnr_before = fn.bufnr('%') matches('^term://', bufname_before) -- sanity command('argument 1') - helpers.feed([[<C-\><C-N>]]) + t.feed([[<C-\><C-N>]]) local bufname_after = fn.bufname('%') local bufnr_after = fn.bufnr('%') - eq('[' .. bufname_before .. ']', helpers.eval('trim(execute("args"))')) + eq('[' .. bufname_before .. ']', t.eval('trim(execute("args"))')) ok(fn.line('$') > 1) eq(bufname_before, bufname_after) eq(bufnr_before, bufnr_after) diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua index 1815c672dc..40c9172010 100644 --- a/test/functional/ex_cmds/cd_spec.lua +++ b/test/functional/ex_cmds/cd_spec.lua @@ -1,16 +1,16 @@ -- Specs for :cd, :tcd, :lcd and getcwd() -local helpers = require('test.functional.helpers')(after_each) - -local eq = helpers.eq -local call = helpers.call -local clear = helpers.clear -local command = helpers.command -local exc_exec = helpers.exc_exec -local pathsep = helpers.get_pathsep() -local skip = helpers.skip -local is_os = helpers.is_os -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) + +local eq = t.eq +local call = t.call +local clear = t.clear +local command = t.command +local exc_exec = t.exc_exec +local pathsep = t.get_pathsep() +local skip = t.skip +local is_os = t.is_os +local mkdir = t.mkdir -- These directories will be created for testing local directories = { @@ -289,14 +289,14 @@ describe('getcwd()', function() end) after_each(function() - helpers.rmdir(directories.global) + t.rmdir(directories.global) end) it('returns empty string if working directory does not exist', function() skip(is_os('win')) command('cd ' .. directories.global) command("call delete('../" .. directories.global .. "', 'd')") - eq('', helpers.eval('getcwd()')) + eq('', t.eval('getcwd()')) end) it("works with 'autochdir' after local directory was set (#9892)", function() diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua index 4499b2172d..83a2c661b0 100644 --- a/test/functional/ex_cmds/cmd_map_spec.lua +++ b/test/functional/ex_cmds/cmd_map_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local feed = helpers.feed -local eq = helpers.eq -local expect = helpers.expect -local eval = helpers.eval -local fn = helpers.fn -local insert = helpers.insert -local write_file = helpers.write_file -local exc_exec = helpers.exc_exec -local command = helpers.command +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local feed = t.feed +local eq = t.eq +local expect = t.expect +local eval = t.eval +local fn = t.fn +local insert = t.insert +local write_file = t.write_file +local exc_exec = t.exc_exec +local command = t.command local Screen = require('test.functional.ui.screen') describe('mappings with <Cmd>', function() diff --git a/test/functional/ex_cmds/debug_spec.lua b/test/functional/ex_cmds/debug_spec.lua index 85327c87e6..7614cf5c7f 100644 --- a/test/functional/ex_cmds/debug_spec.lua +++ b/test/functional/ex_cmds/debug_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed = helpers.feed -local clear = helpers.clear +local feed = t.feed +local clear = t.clear describe(':debug', function() local screen diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua index fc7714d16b..6ebc292402 100644 --- a/test/functional/ex_cmds/dict_notifications_spec.lua +++ b/test/functional/ex_cmds/dict_notifications_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_alive = helpers.assert_alive -local clear, source = helpers.clear, helpers.source -local api = helpers.api -local insert = helpers.insert -local eq, next_msg = helpers.eq, helpers.next_msg -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local command = helpers.command -local eval = helpers.eval +local t = require('test.functional.testutil')(after_each) +local assert_alive = t.assert_alive +local clear, source = t.clear, t.source +local api = t.api +local insert = t.insert +local eq, next_msg = t.eq, t.next_msg +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local command = t.command +local eval = t.eval describe('Vimscript dictionary notifications', function() local channel diff --git a/test/functional/ex_cmds/digraphs_spec.lua b/test/functional/ex_cmds/digraphs_spec.lua index 24b6f7c53b..ac33409a35 100644 --- a/test/functional/ex_cmds/digraphs_spec.lua +++ b/test/functional/ex_cmds/digraphs_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local feed = t.feed local Screen = require('test.functional.ui.screen') describe(':digraphs', function() diff --git a/test/functional/ex_cmds/drop_spec.lua b/test/functional/ex_cmds/drop_spec.lua index cfba4e93bd..ad813d13d3 100644 --- a/test/functional/ex_cmds/drop_spec.lua +++ b/test/functional/ex_cmds/drop_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local command = helpers.command +local t = require('test.functional.testutil')(after_each) +local command = t.command local Screen = require('test.functional.ui.screen') -local clear, feed, feed_command = helpers.clear, helpers.feed, helpers.feed_command -local exec = helpers.exec +local clear, feed, feed_command = t.clear, t.feed, t.feed_command +local exec = t.exec describe(':drop', function() local screen diff --git a/test/functional/ex_cmds/echo_spec.lua b/test/functional/ex_cmds/echo_spec.lua index e9176a6204..69b16be788 100644 --- a/test/functional/ex_cmds/echo_spec.lua +++ b/test/functional/ex_cmds/echo_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq +local eq = t.eq local NIL = vim.NIL -local eval = helpers.eval -local clear = helpers.clear -local api = helpers.api -local fn = helpers.fn -local source = helpers.source -local dedent = helpers.dedent -local command = helpers.command -local exc_exec = helpers.exc_exec -local exec_capture = helpers.exec_capture -local matches = helpers.matches +local eval = t.eval +local clear = t.clear +local api = t.api +local fn = t.fn +local source = t.source +local dedent = t.dedent +local command = t.command +local exc_exec = t.exc_exec +local exec_capture = t.exec_capture +local matches = t.matches describe(':echo :echon :echomsg :echoerr', function() local fn_tbl = { 'String', 'StringN', 'StringMsg', 'StringErr' } @@ -255,7 +255,7 @@ describe(':echo :echon :echomsg :echoerr', function() eval('add(l, l)') -- Regression: the below line used to crash (add returns original list and -- there was error in dumping partials). Tested explicitly in - -- test/unit/api/private_helpers_spec.lua. + -- test/unit/api/private_t_spec.lua. eval('add(l, function("Test1", l))') eq( dedent( diff --git a/test/functional/ex_cmds/edit_spec.lua b/test/functional/ex_cmds/edit_spec.lua index 9d4effd72e..1ae34abad2 100644 --- a/test/functional/ex_cmds/edit_spec.lua +++ b/test/functional/ex_cmds/edit_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, command, fn = helpers.eq, helpers.command, helpers.fn -local ok = helpers.ok -local matches = helpers.matches -local clear = helpers.clear -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local eq, command, fn = t.eq, t.command, t.fn +local ok = t.ok +local matches = t.matches +local clear = t.clear +local feed = t.feed describe(':edit', function() before_each(function() diff --git a/test/functional/ex_cmds/encoding_spec.lua b/test/functional/ex_cmds/encoding_spec.lua index 8953fb8eaf..7f46d103aa 100644 --- a/test/functional/ex_cmds/encoding_spec.lua +++ b/test/functional/ex_cmds/encoding_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed_command, feed = helpers.clear, helpers.feed_command, helpers.feed -local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval +local t = require('test.functional.testutil')(after_each) +local clear, feed_command, feed = t.clear, t.feed_command, t.feed +local eq, neq, eval = t.eq, t.neq, t.eval describe('&encoding', function() before_each(function() diff --git a/test/functional/ex_cmds/excmd_spec.lua b/test/functional/ex_cmds/excmd_spec.lua index d16a52ee62..70767615b3 100644 --- a/test/functional/ex_cmds/excmd_spec.lua +++ b/test/functional/ex_cmds/excmd_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local command = helpers.command -local eq = helpers.eq -local clear = helpers.clear -local fn = helpers.fn -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive +local t = require('test.functional.testutil')(after_each) +local command = t.command +local eq = t.eq +local clear = t.clear +local fn = t.fn +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive describe('Ex cmds', function() before_each(function() diff --git a/test/functional/ex_cmds/file_spec.lua b/test/functional/ex_cmds/file_spec.lua index a48c408600..a4c2fb5472 100644 --- a/test/functional/ex_cmds/file_spec.lua +++ b/test/functional/ex_cmds/file_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local fn = helpers.fn -local rmdir = helpers.rmdir -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local fn = t.fn +local rmdir = t.rmdir +local mkdir = t.mkdir describe(':file', function() local swapdir = vim.uv.cwd() .. '/Xtest-file_spec' diff --git a/test/functional/ex_cmds/grep_spec.lua b/test/functional/ex_cmds/grep_spec.lua index bf81ba2137..91007b3095 100644 --- a/test/functional/ex_cmds/grep_spec.lua +++ b/test/functional/ex_cmds/grep_spec.lua @@ -1,6 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed_command, feed, ok, eval = - helpers.clear, helpers.feed_command, helpers.feed, helpers.ok, helpers.eval +local t = require('test.functional.testutil')(after_each) +local clear, feed_command, feed, ok, eval = t.clear, t.feed_command, t.feed, t.ok, t.eval describe(':grep', function() before_each(clear) diff --git a/test/functional/ex_cmds/help_spec.lua b/test/functional/ex_cmds/help_spec.lua index cee33de1a6..b8f8ee95ec 100644 --- a/test/functional/ex_cmds/help_spec.lua +++ b/test/functional/ex_cmds/help_spec.lua @@ -1,19 +1,19 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local fn = helpers.fn -local api = helpers.api -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local write_file = helpers.write_file +local clear = t.clear +local command = t.command +local eq = t.eq +local fn = t.fn +local api = t.api +local mkdir = t.mkdir +local rmdir = t.rmdir +local write_file = t.write_file describe(':help', function() before_each(clear) it('window closed makes cursor return to a valid win/buf #9773', function() - helpers.add_builddir_to_rtp() + t.add_builddir_to_rtp() command('help help') eq(1001, fn.win_getid()) command('quit') diff --git a/test/functional/ex_cmds/highlight_spec.lua b/test/functional/ex_cmds/highlight_spec.lua index 897a2997bc..77ae4d1dfb 100644 --- a/test/functional/ex_cmds/highlight_spec.lua +++ b/test/functional/ex_cmds/highlight_spec.lua @@ -1,11 +1,11 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local eq, command = helpers.eq, helpers.command -local clear = helpers.clear -local eval, exc_exec = helpers.eval, helpers.exc_exec -local exec = helpers.exec -local fn = helpers.fn -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local eq, command = t.eq, t.command +local clear = t.clear +local eval, exc_exec = t.eval, t.exc_exec +local exec = t.exec +local fn = t.fn +local api = t.api describe(':highlight', function() local screen diff --git a/test/functional/ex_cmds/ls_spec.lua b/test/functional/ex_cmds/ls_spec.lua index 5f59402d10..43b72ce69e 100644 --- a/test/functional/ex_cmds/ls_spec.lua +++ b/test/functional/ex_cmds/ls_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local api = helpers.api -local testprg = helpers.testprg -local retry = helpers.retry +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed +local api = t.api +local testprg = t.testprg +local retry = t.retry describe(':ls', function() before_each(function() diff --git a/test/functional/ex_cmds/make_spec.lua b/test/functional/ex_cmds/make_spec.lua index dd47bdec58..22b7c6a217 100644 --- a/test/functional/ex_cmds/make_spec.lua +++ b/test/functional/ex_cmds/make_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eval = helpers.eval -local has_powershell = helpers.has_powershell -local matches = helpers.matches -local api = helpers.api -local testprg = helpers.testprg +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eval = t.eval +local has_powershell = t.has_powershell +local matches = t.matches +local api = t.api +local testprg = t.testprg describe(':make', function() clear() @@ -18,7 +18,7 @@ describe(':make', function() return end before_each(function() - helpers.set_shell_powershell() + t.set_shell_powershell() end) it('captures stderr & non zero exit code #14349', function() diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua index cc863d45cb..758b055a89 100644 --- a/test/functional/ex_cmds/map_spec.lua +++ b/test/functional/ex_cmds/map_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local exec = helpers.exec -local exec_capture = helpers.exec_capture -local feed = helpers.feed -local api = helpers.api -local clear = helpers.clear -local command = helpers.command -local expect = helpers.expect -local insert = helpers.insert -local eval = helpers.eval +local eq = t.eq +local exec = t.exec +local exec_capture = t.exec_capture +local feed = t.feed +local api = t.api +local clear = t.clear +local command = t.command +local expect = t.expect +local insert = t.insert +local eval = t.eval describe(':*map', function() before_each(clear) diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua index bb6ef72787..1e243dabab 100644 --- a/test/functional/ex_cmds/menu_spec.lua +++ b/test/functional/ex_cmds/menu_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, command = helpers.clear, helpers.command -local expect, feed = helpers.expect, helpers.feed -local eq, eval = helpers.eq, helpers.eval -local fn = helpers.fn +local t = require('test.functional.testutil')(after_each) +local clear, command = t.clear, t.command +local expect, feed = t.expect, t.feed +local eq, eval = t.eq, t.eval +local fn = t.fn describe(':emenu', function() before_each(function() diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua index 6f2e0be3d5..a7d62e5493 100644 --- a/test/functional/ex_cmds/mksession_spec.lua +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local get_pathsep = helpers.get_pathsep -local eq = helpers.eq -local neq = helpers.neq -local fn = helpers.fn -local matches = helpers.matches +local clear = t.clear +local command = t.command +local get_pathsep = t.get_pathsep +local eq = t.eq +local neq = t.neq +local fn = t.fn +local matches = t.matches local pesc = vim.pesc -local rmdir = helpers.rmdir +local rmdir = t.rmdir local sleep = vim.uv.sleep -local api = helpers.api -local skip = helpers.skip -local is_os = helpers.is_os -local mkdir = helpers.mkdir +local api = t.api +local skip = t.skip +local is_os = t.is_os +local mkdir = t.mkdir local file_prefix = 'Xtest-functional-ex_cmds-mksession_spec' diff --git a/test/functional/ex_cmds/mkview_spec.lua b/test/functional/ex_cmds/mkview_spec.lua index de0a4fe0ea..1658d96229 100644 --- a/test/functional/ex_cmds/mkview_spec.lua +++ b/test/functional/ex_cmds/mkview_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local get_pathsep = helpers.get_pathsep -local eq = helpers.eq -local fn = helpers.fn -local rmdir = helpers.rmdir -local mkdir = helpers.mkdir +local clear = t.clear +local command = t.command +local get_pathsep = t.get_pathsep +local eq = t.eq +local fn = t.fn +local rmdir = t.rmdir +local mkdir = t.mkdir local file_prefix = 'Xtest-functional-ex_cmds-mkview_spec' diff --git a/test/functional/ex_cmds/normal_spec.lua b/test/functional/ex_cmds/normal_spec.lua index 723bfefcf4..943b994f62 100644 --- a/test/functional/ex_cmds/normal_spec.lua +++ b/test/functional/ex_cmds/normal_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local fn = helpers.fn -local feed = helpers.feed -local expect = helpers.expect -local eq = helpers.eq -local eval = helpers.eval +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local fn = t.fn +local feed = t.feed +local expect = t.expect +local eq = t.eq +local eval = t.eval before_each(clear) diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua index 07ae3ae341..357fc3bcfb 100644 --- a/test/functional/ex_cmds/oldfiles_spec.lua +++ b/test/functional/ex_cmds/oldfiles_spec.lua @@ -1,13 +1,13 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local expect_exit = helpers.expect_exit -local api, eq, feed_command = helpers.api, helpers.eq, helpers.feed_command -local feed, poke_eventloop = helpers.feed, helpers.poke_eventloop -local ok = helpers.ok -local eval = helpers.eval +local clear = t.clear +local command = t.command +local expect_exit = t.expect_exit +local api, eq, feed_command = t.api, t.eq, t.feed_command +local feed, poke_eventloop = t.feed, t.poke_eventloop +local ok = t.ok +local eval = t.eval local shada_file = 'Xtest.shada' @@ -66,12 +66,12 @@ describe(':oldfiles', function() feed_command('rshada!') local function get_oldfiles(cmd) - local t = eval([[split(execute(']] .. cmd .. [['), "\n")]]) - for i, _ in ipairs(t) do - t[i] = t[i]:gsub('^%d+:%s+', '') + local q = eval([[split(execute(']] .. cmd .. [['), "\n")]]) + for i, _ in ipairs(q) do + q[i] = q[i]:gsub('^%d+:%s+', '') end - table.sort(t) - return t + table.sort(q) + return q end local oldfiles = get_oldfiles('oldfiles') @@ -109,7 +109,7 @@ describe(':browse oldfiles', function() -- Ensure v:oldfiles isn't busted. Since things happen so fast, -- the ordering of v:oldfiles is unstable (it uses qsort() under-the-hood). -- Let's verify the contents and the length of v:oldfiles before moving on. - oldfiles = helpers.api.nvim_get_vvar('oldfiles') + oldfiles = t.api.nvim_get_vvar('oldfiles') eq(2, #oldfiles) ok(filename == oldfiles[1] or filename == oldfiles[2]) ok(filename2 == oldfiles[1] or filename2 == oldfiles[2]) diff --git a/test/functional/ex_cmds/print_commands_spec.lua b/test/functional/ex_cmds/print_commands_spec.lua index ba5ec7d2d1..8ec8b5c86d 100644 --- a/test/functional/ex_cmds/print_commands_spec.lua +++ b/test/functional/ex_cmds/print_commands_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, command, fn = helpers.clear, helpers.eq, helpers.command, helpers.fn +local t = require('test.functional.testutil')(after_each) +local clear, eq, command, fn = t.clear, t.eq, t.command, t.fn describe(':z^', function() before_each(clear) diff --git a/test/functional/ex_cmds/profile_spec.lua b/test/functional/ex_cmds/profile_spec.lua index f85dcc60ff..38bb7988ee 100644 --- a/test/functional/ex_cmds/profile_spec.lua +++ b/test/functional/ex_cmds/profile_spec.lua @@ -1,14 +1,14 @@ require('os') local uv = vim.uv -local helpers = require('test.functional.helpers')(after_each) -local eval = helpers.eval -local command = helpers.command -local eq, neq = helpers.eq, helpers.neq -local tempfile = helpers.tmpname() -local source = helpers.source -local matches = helpers.matches -local read_file = helpers.read_file +local t = require('test.functional.testutil')(after_each) +local eval = t.eval +local command = t.command +local eq, neq = t.eq, t.neq +local tempfile = t.tmpname() +local source = t.source +local matches = t.matches +local read_file = t.read_file -- tmpname() also creates the file on POSIX systems. Remove it again. -- We just need the name, ignoring any race conditions. @@ -25,10 +25,10 @@ local function assert_file_exists_not(filepath) end describe(':profile', function() - before_each(helpers.clear) + before_each(t.clear) after_each(function() - helpers.expect_exit(command, 'qall!') + t.expect_exit(command, 'qall!') if uv.fs_stat(tempfile).uid ~= nil then os.remove(tempfile) end diff --git a/test/functional/ex_cmds/quickfix_commands_spec.lua b/test/functional/ex_cmds/quickfix_commands_spec.lua index 5af0198ffe..7e724dd1dd 100644 --- a/test/functional/ex_cmds/quickfix_commands_spec.lua +++ b/test/functional/ex_cmds/quickfix_commands_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed = helpers.feed -local eq = helpers.eq -local clear = helpers.clear -local fn = helpers.fn -local command = helpers.command -local exc_exec = helpers.exc_exec -local write_file = helpers.write_file -local api = helpers.api -local source = helpers.source +local feed = t.feed +local eq = t.eq +local clear = t.clear +local fn = t.fn +local command = t.command +local exc_exec = t.exc_exec +local write_file = t.write_file +local api = t.api +local source = t.source local file_base = 'Xtest-functional-ex_cmds-quickfix_commands' diff --git a/test/functional/ex_cmds/quit_spec.lua b/test/functional/ex_cmds/quit_spec.lua index 5a1759dab3..4cc15cc378 100644 --- a/test/functional/ex_cmds/quit_spec.lua +++ b/test/functional/ex_cmds/quit_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear +local t = require('test.functional.testutil')(after_each) +local clear = t.clear describe(':qa', function() before_each(function() diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua index 4c963c5da7..966e06d705 100644 --- a/test/functional/ex_cmds/script_spec.lua +++ b/test/functional/ex_cmds/script_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local neq = helpers.neq -local command = helpers.command -local exec_capture = helpers.exec_capture -local write_file = helpers.write_file -local api = helpers.api -local clear = helpers.clear -local dedent = helpers.dedent -local exc_exec = helpers.exc_exec -local missing_provider = helpers.missing_provider +local eq = t.eq +local neq = t.neq +local command = t.command +local exec_capture = t.exec_capture +local write_file = t.write_file +local api = t.api +local clear = t.clear +local dedent = t.dedent +local exc_exec = t.exc_exec +local missing_provider = t.missing_provider local tmpfile = 'X_ex_cmds_script' diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua index 06de7f23a9..8954f6e5d6 100644 --- a/test/functional/ex_cmds/sign_spec.lua +++ b/test/functional/ex_cmds/sign_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, assert_alive = helpers.clear, helpers.eq, helpers.assert_alive -local command = helpers.command -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local clear, eq, assert_alive = t.clear, t.eq, t.assert_alive +local command = t.command +local api = t.api describe('sign', function() before_each(clear) diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua index 5ce0e395bd..d8aa4f2747 100644 --- a/test/functional/ex_cmds/source_spec.lua +++ b/test/functional/ex_cmds/source_spec.lua @@ -1,23 +1,23 @@ -local helpers = require('test.functional.helpers')(after_each) -local command = helpers.command -local insert = helpers.insert -local eq = helpers.eq -local clear = helpers.clear -local api = helpers.api -local feed = helpers.feed -local feed_command = helpers.feed_command -local write_file = helpers.write_file -local tmpname = helpers.tmpname -local exec = helpers.exec -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local eval = helpers.eval -local exec_capture = helpers.exec_capture -local neq = helpers.neq -local matches = helpers.matches -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local command = t.command +local insert = t.insert +local eq = t.eq +local clear = t.clear +local api = t.api +local feed = t.feed +local feed_command = t.feed_command +local write_file = t.write_file +local tmpname = t.tmpname +local exec = t.exec +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local eval = t.eval +local exec_capture = t.exec_capture +local neq = t.neq +local matches = t.matches +local mkdir = t.mkdir +local rmdir = t.rmdir +local is_os = t.is_os describe(':source', function() before_each(function() diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index 7b7dea89c6..fc2e1eda82 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -1,29 +1,29 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local uv = vim.uv -local eq, eval, expect, exec = helpers.eq, helpers.eval, helpers.expect, helpers.exec -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed -local fn = helpers.fn -local nvim_prog = helpers.nvim_prog -local ok = helpers.ok -local rmdir = helpers.rmdir -local new_argv = helpers.new_argv -local new_pipename = helpers.new_pipename +local eq, eval, expect, exec = t.eq, t.eval, t.expect, t.exec +local assert_alive = t.assert_alive +local clear = t.clear +local command = t.command +local feed = t.feed +local fn = t.fn +local nvim_prog = t.nvim_prog +local ok = t.ok +local rmdir = t.rmdir +local new_argv = t.new_argv +local new_pipename = t.new_pipename local pesc = vim.pesc -local os_kill = helpers.os_kill -local set_session = helpers.set_session -local spawn = helpers.spawn -local async_meths = helpers.async_meths -local expect_msg_seq = helpers.expect_msg_seq -local pcall_err = helpers.pcall_err -local mkdir = helpers.mkdir -local poke_eventloop = helpers.poke_eventloop -local api = helpers.api -local retry = helpers.retry -local write_file = helpers.write_file +local os_kill = t.os_kill +local set_session = t.set_session +local spawn = t.spawn +local async_meths = t.async_meths +local expect_msg_seq = t.expect_msg_seq +local pcall_err = t.pcall_err +local mkdir = t.mkdir +local poke_eventloop = t.poke_eventloop +local api = t.api +local retry = t.retry +local write_file = t.write_file describe(':recover', function() before_each(clear) @@ -110,7 +110,7 @@ describe("preserve and (R)ecover with custom 'directory'", function() end) it('killing TUI process without :preserve #22096', function() - helpers.skip(helpers.is_os('win')) + t.skip(t.is_os('win')) local screen0 = Screen.new() screen0:attach() local child_server = new_pipename() @@ -118,7 +118,7 @@ describe("preserve and (R)ecover with custom 'directory'", function() env = { VIMRUNTIME = os.getenv('VIMRUNTIME') }, }) screen0:expect({ any = pesc('[No Name]') }) -- Wait for the child process to start. - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) set_session(child_session) local swappath1 = setup_swapname() set_session(nvim0) diff --git a/test/functional/ex_cmds/syntax_spec.lua b/test/functional/ex_cmds/syntax_spec.lua index ccdd604c55..f8662e7d07 100644 --- a/test/functional/ex_cmds/syntax_spec.lua +++ b/test/functional/ex_cmds/syntax_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local exc_exec = helpers.exc_exec +local eq = t.eq +local clear = t.clear +local exc_exec = t.exc_exec describe(':syntax', function() before_each(clear) diff --git a/test/functional/ex_cmds/trust_spec.lua b/test/functional/ex_cmds/trust_spec.lua index 2997b504fa..7c84d1d04b 100644 --- a/test/functional/ex_cmds/trust_spec.lua +++ b/test/functional/ex_cmds/trust_spec.lua @@ -1,27 +1,27 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local command = helpers.command -local exec_capture = helpers.exec_capture -local matches = helpers.matches -local pathsep = helpers.get_pathsep() -local is_os = helpers.is_os -local fn = helpers.fn +local eq = t.eq +local clear = t.clear +local command = t.command +local exec_capture = t.exec_capture +local matches = t.matches +local pathsep = t.get_pathsep() +local is_os = t.is_os +local fn = t.fn describe(':trust', function() local xstate = 'Xstate' setup(function() - helpers.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim')) + t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim')) end) teardown(function() - helpers.rmdir(xstate) + t.rmdir(xstate) end) before_each(function() - helpers.write_file('test_file', 'test') + t.write_file('test_file', 'test') clear { env = { XDG_STATE_HOME = xstate } } end) @@ -31,37 +31,37 @@ describe(':trust', function() it('trust then deny then remove a file using current buffer', function() local cwd = fn.getcwd() - local hash = fn.sha256(helpers.read_file('test_file')) + local hash = fn.sha256(t.read_file('test_file')) command('edit test_file') matches('^Allowed ".*test_file" in trust database%.$', exec_capture('trust')) - local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format('%s %s', hash, cwd .. pathsep .. 'test_file'), vim.trim(trust)) matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny')) - trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust)) matches('^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove')) - trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format(''), vim.trim(trust)) end) it('deny then trust then remove a file using current buffer', function() local cwd = fn.getcwd() - local hash = fn.sha256(helpers.read_file('test_file')) + local hash = fn.sha256(t.read_file('test_file')) command('edit test_file') matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny')) - local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust)) matches('^Allowed ".*test_file" in trust database%.$', exec_capture('trust')) - trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format('%s %s', hash, cwd .. pathsep .. 'test_file'), vim.trim(trust)) matches('^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove')) - trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format(''), vim.trim(trust)) end) @@ -69,14 +69,14 @@ describe(':trust', function() local cwd = fn.getcwd() matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny test_file')) - local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust)) matches( '^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove test_file') ) - trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust') + trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust') eq(string.format(''), vim.trim(trust)) end) end) diff --git a/test/functional/ex_cmds/undojoin_spec.lua b/test/functional/ex_cmds/undojoin_spec.lua index 7803906619..4ba530562e 100644 --- a/test/functional/ex_cmds/undojoin_spec.lua +++ b/test/functional/ex_cmds/undojoin_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local insert = helpers.insert -local feed = helpers.feed -local expect = helpers.expect -local feed_command = helpers.feed_command -local exc_exec = helpers.exc_exec +local eq = t.eq +local clear = t.clear +local insert = t.insert +local feed = t.feed +local expect = t.expect +local feed_command = t.feed_command +local exc_exec = t.exc_exec describe(':undojoin command', function() before_each(function() diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua index ba90793a37..9ec0ee02ae 100644 --- a/test/functional/ex_cmds/verbose_spec.lua +++ b/test/functional/ex_cmds/verbose_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local exec = helpers.exec -local exec_capture = helpers.exec_capture -local write_file = helpers.write_file -local call_viml_function = helpers.api.nvim_call_function +local clear = t.clear +local eq = t.eq +local exec = t.exec +local exec_capture = t.exec_capture +local write_file = t.write_file +local call_viml_function = t.api.nvim_call_function local function last_set_tests(cmd) local script_location, script_file @@ -15,7 +15,7 @@ local function last_set_tests(cmd) script_file = 'test_verbose.lua' local current_dir = call_viml_function('getcwd', {}) current_dir = call_viml_function('fnamemodify', { current_dir, ':~' }) - script_location = table.concat { current_dir, helpers.get_pathsep(), script_file } + script_location = table.concat { current_dir, t.get_pathsep(), script_file } write_file( script_file, diff --git a/test/functional/ex_cmds/wincmd_spec.lua b/test/functional/ex_cmds/wincmd_spec.lua index 98c6358f45..2f302daeeb 100644 --- a/test/functional/ex_cmds/wincmd_spec.lua +++ b/test/functional/ex_cmds/wincmd_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local fn = helpers.fn -local command = helpers.command +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local fn = t.fn +local command = t.command it(':wincmd accepts a count', function() clear() diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua index f711731072..dd829863b1 100644 --- a/test/functional/ex_cmds/write_spec.lua +++ b/test/functional/ex_cmds/write_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local eq, eval, clear, write_file, source, insert = - helpers.eq, helpers.eval, helpers.clear, helpers.write_file, helpers.source, helpers.insert -local pcall_err = helpers.pcall_err -local command = helpers.command -local feed_command = helpers.feed_command -local fn = helpers.fn -local api = helpers.api -local skip = helpers.skip -local is_os = helpers.is_os -local is_ci = helpers.is_ci + t.eq, t.eval, t.clear, t.write_file, t.source, t.insert +local pcall_err = t.pcall_err +local command = t.command +local feed_command = t.feed_command +local fn = t.fn +local api = t.api +local skip = t.skip +local is_os = t.is_os +local is_ci = t.is_ci local fname = 'Xtest-functional-ex_cmds-write' local fname_bak = fname .. '~' diff --git a/test/functional/ex_cmds/wundo_spec.lua b/test/functional/ex_cmds/wundo_spec.lua index 78081fa45f..c926ab98e5 100644 --- a/test/functional/ex_cmds/wundo_spec.lua +++ b/test/functional/ex_cmds/wundo_spec.lua @@ -1,13 +1,8 @@ -- Specs for :wundo and underlying functions -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local command, clear, eval, spawn, nvim_prog, set_session = - helpers.command, - helpers.clear, - helpers.eval, - helpers.spawn, - helpers.nvim_prog, - helpers.set_session + t.command, t.clear, t.eval, t.spawn, t.nvim_prog, t.set_session describe(':wundo', function() before_each(clear) diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua index 23ae1440e6..f44e8f2408 100644 --- a/test/functional/ex_cmds/wviminfo_spec.lua +++ b/test/functional/ex_cmds/wviminfo_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command, eq, neq, write_file = helpers.command, helpers.eq, helpers.neq, helpers.write_file -local read_file = helpers.read_file -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command, eq, neq, write_file = t.command, t.eq, t.neq, t.write_file +local read_file = t.read_file +local is_os = t.is_os describe(':wshada', function() local shada_file = 'wshada_test' diff --git a/test/functional/example_spec.lua b/test/functional/example_spec.lua index 5fc55f4aab..ddc55155bf 100644 --- a/test/functional/example_spec.lua +++ b/test/functional/example_spec.lua @@ -1,12 +1,12 @@ -- To run this test: -- TEST_FILE=test/functional/example_spec.lua make functionaltest -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local feed = helpers.feed +local clear = t.clear +local command = t.command +local eq = t.eq +local feed = t.feed describe('example', function() local screen diff --git a/test/functional/legacy/002_filename_recognition_spec.lua b/test/functional/legacy/002_filename_recognition_spec.lua index 26a62d92fe..fb6dbbdc0b 100644 --- a/test/functional/legacy/002_filename_recognition_spec.lua +++ b/test/functional/legacy/002_filename_recognition_spec.lua @@ -1,9 +1,9 @@ -- Test if URLs are recognized as filenames by commands such as "gf". Here -- we'll use `expand("<cfile>")` since "gf" would need to open the file. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('filename recognition', function() setup(clear) diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua index 9b0df024c8..1ae5c02aca 100644 --- a/test/functional/legacy/004_bufenter_with_modelines_spec.lua +++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua @@ -1,9 +1,9 @@ -- Test for autocommand that changes current buffer on BufEnter event. -- Check if modelines are interpreted for the correct buffer. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('BufEnter with modelines', function() setup(clear) diff --git a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua index 8e977aa73e..2e833a9fb3 100644 --- a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua +++ b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua @@ -1,10 +1,10 @@ -- Test for autocommand that deletes the current buffer on BufLeave event. -- Also test deleting the last buffer, should give a new, empty buffer. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, expect = helpers.command, helpers.expect -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local command, expect = t.command, t.expect +local poke_eventloop = t.poke_eventloop describe('test5', function() setup(clear) diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua index d4e4547c43..60578e6aaf 100644 --- a/test/functional/legacy/007_ball_buffer_list_spec.lua +++ b/test/functional/legacy/007_ball_buffer_list_spec.lua @@ -1,8 +1,8 @@ -- Test for autocommand that changes the buffer list, when doing ":ball". -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe(':ball', function() setup(clear) diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua index 16f0216bc0..ad68b78f4d 100644 --- a/test/functional/legacy/008_autocommands_spec.lua +++ b/test/functional/legacy/008_autocommands_spec.lua @@ -1,13 +1,12 @@ -- Test for BufWritePre autocommand that deletes or unloads the buffer. -- Test for BufUnload autocommand that unloads all other buffers. -local helpers = require('test.functional.helpers')(after_each) -local source = helpers.source -local clear, command, expect, eq, eval = - helpers.clear, helpers.command, helpers.expect, helpers.eq, helpers.eval -local write_file, dedent = helpers.write_file, helpers.dedent -local read_file = helpers.read_file -local expect_exit = helpers.expect_exit +local t = require('test.functional.testutil')(after_each) +local source = t.source +local clear, command, expect, eq, eval = t.clear, t.command, t.expect, t.eq, t.eval +local write_file, dedent = t.write_file, t.dedent +local read_file = t.read_file +local expect_exit = t.expect_exit describe('autocommands that delete and unload buffers:', function() local test_file = 'Xtest-008_autocommands.out' diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua index eba878b99a..13531410cf 100644 --- a/test/functional/legacy/011_autocommands_spec.lua +++ b/test/functional/legacy/011_autocommands_spec.lua @@ -12,19 +12,12 @@ -- Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz" -- being modified outside of Vim (noticed on Solaris). -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local clear, feed_command, expect, eq, neq, dedent, write_file, feed = - helpers.clear, - helpers.feed_command, - helpers.expect, - helpers.eq, - helpers.neq, - helpers.dedent, - helpers.write_file, - helpers.feed -local command = helpers.command -local read_file = helpers.read_file -local is_os = helpers.is_os + t.clear, t.feed_command, t.expect, t.eq, t.neq, t.dedent, t.write_file, t.feed +local command = t.command +local read_file = t.read_file +local is_os = t.is_os local function has_gzip() local null = is_os('win') and 'nul' or '/dev/null' diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua index b428318e3f..204ccec55c 100644 --- a/test/functional/legacy/012_directory_spec.lua +++ b/test/functional/legacy/012_directory_spec.lua @@ -3,19 +3,19 @@ -- - "./dir", in directory relative to file -- - "dir", in directory relative to current dir -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local neq = helpers.neq -local poke_eventloop = helpers.poke_eventloop -local fn = helpers.fn -local api = helpers.api -local clear = helpers.clear -local insert = helpers.insert -local command = helpers.command -local write_file = helpers.write_file -local expect_exit = helpers.expect_exit -local mkdir = helpers.mkdir +local eq = t.eq +local neq = t.neq +local poke_eventloop = t.poke_eventloop +local fn = t.fn +local api = t.api +local clear = t.clear +local insert = t.insert +local command = t.command +local write_file = t.write_file +local expect_exit = t.expect_exit +local mkdir = t.mkdir local function ls_dir_sorted(dirname) local files = {} @@ -44,8 +44,8 @@ describe("'directory' option", function() end) teardown(function() expect_exit(command, 'qall!') - helpers.rmdir('Xtest.je') - helpers.rmdir('Xtest2') + t.rmdir('Xtest.je') + t.rmdir('Xtest2') os.remove('Xtest1') end) diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua index d73ff06972..7acba51c59 100644 --- a/test/functional/legacy/015_alignment_spec.lua +++ b/test/functional/legacy/015_alignment_spec.lua @@ -2,9 +2,9 @@ -- Also test formatting a paragraph. -- Also test undo after ":%s" and formatting. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('alignment', function() setup(clear) diff --git a/test/functional/legacy/018_unset_smart_indenting_spec.lua b/test/functional/legacy/018_unset_smart_indenting_spec.lua index 94fbb283f4..b4745f0937 100644 --- a/test/functional/legacy/018_unset_smart_indenting_spec.lua +++ b/test/functional/legacy/018_unset_smart_indenting_spec.lua @@ -1,12 +1,12 @@ -- Tests for not doing smart indenting when it isn't set. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local feed = helpers.feed -local clear = helpers.clear -local insert = helpers.insert -local expect = helpers.expect -local feed_command = helpers.feed_command +local feed = t.feed +local clear = t.clear +local insert = t.insert +local expect = t.expect +local feed_command = t.feed_command describe('unset smart indenting', function() before_each(clear) diff --git a/test/functional/legacy/019_smarttab_expandtab_spec.lua b/test/functional/legacy/019_smarttab_expandtab_spec.lua index 7b03ee8e99..8898ba391f 100644 --- a/test/functional/legacy/019_smarttab_expandtab_spec.lua +++ b/test/functional/legacy/019_smarttab_expandtab_spec.lua @@ -1,9 +1,9 @@ -- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. -- Also test that dv_ works correctly -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function() setup(clear) diff --git a/test/functional/legacy/020_blockwise_visual_spec.lua b/test/functional/legacy/020_blockwise_visual_spec.lua index 8d90b1c77d..1797cc6077 100644 --- a/test/functional/legacy/020_blockwise_visual_spec.lua +++ b/test/functional/legacy/020_blockwise_visual_spec.lua @@ -2,9 +2,9 @@ -- First test for undo working properly when executing commands from a register. -- Also test this in an empty buffer. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('blockwise visual', function() setup(clear) diff --git a/test/functional/legacy/021_control_wi_spec.lua b/test/functional/legacy/021_control_wi_spec.lua index 94871433cd..a7e0ff29d2 100644 --- a/test/functional/legacy/021_control_wi_spec.lua +++ b/test/functional/legacy/021_control_wi_spec.lua @@ -1,8 +1,8 @@ -- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('CTRL-W CTRL-I', function() setup(clear) diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua index 64b2f6fa95..b354d5cfa4 100644 --- a/test/functional/legacy/023_edit_arguments_spec.lua +++ b/test/functional/legacy/023_edit_arguments_spec.lua @@ -1,9 +1,9 @@ -- Tests for complicated + argument to :edit command -local helpers = require('test.functional.helpers')(after_each) -local clear, insert = helpers.clear, helpers.insert -local command, expect = helpers.command, helpers.expect -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear, insert = t.clear, t.insert +local command, expect = t.command, t.expect +local poke_eventloop = t.poke_eventloop describe(':edit', function() setup(clear) diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua index 33bab05404..fe965c77d5 100644 --- a/test/functional/legacy/025_jump_tag_hidden_spec.lua +++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua @@ -1,9 +1,9 @@ -- Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag. -- This only works for Unix, because of the symbolic link. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('jump to a tag with hidden set', function() setup(clear) @@ -23,7 +23,7 @@ describe('jump to a tag with hidden set', function() feed_command('set hidden') -- Create a link from test25.dir to the current directory. - if helpers.is_os('win') then + if t.is_os('win') then feed_command('!rd /q/s test25.dir') feed_command('!mklink /j test25.dir .') else @@ -33,7 +33,7 @@ describe('jump to a tag with hidden set', function() -- Create tags.text, with the current directory name inserted. feed_command('/tags line') - feed_command('r !' .. (helpers.is_os('win') and 'cd' or 'pwd')) + feed_command('r !' .. (t.is_os('win') and 'cd' or 'pwd')) feed('d$/test<cr>') feed('hP:.w! tags.test<cr>') @@ -44,7 +44,7 @@ describe('jump to a tag with hidden set', function() feed('G<C-]> x:yank a<cr>') feed_command("call delete('tags.test')") feed_command("call delete('Xxx')") - if helpers.is_os('win') then + if t.is_os('win') then feed_command('!rd /q test25.dir') else feed_command('!rm -f test25.dir') diff --git a/test/functional/legacy/026_execute_while_if_spec.lua b/test/functional/legacy/026_execute_while_if_spec.lua index ea8abed7ae..d208c30270 100644 --- a/test/functional/legacy/026_execute_while_if_spec.lua +++ b/test/functional/legacy/026_execute_while_if_spec.lua @@ -1,11 +1,11 @@ -- Test for :execute, :while and :if -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local expect = helpers.expect -local source = helpers.source -local command = helpers.command +local clear = t.clear +local expect = t.expect +local source = t.source +local command = t.command describe(':execute, :while and :if', function() setup(clear) diff --git a/test/functional/legacy/028_source_ctrl_v_spec.lua b/test/functional/legacy/028_source_ctrl_v_spec.lua index fabf831341..903ff44b7d 100644 --- a/test/functional/legacy/028_source_ctrl_v_spec.lua +++ b/test/functional/legacy/028_source_ctrl_v_spec.lua @@ -1,8 +1,8 @@ -- Test for sourcing a file with CTRL-V's at the end of the line -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('CTRL-V at the end of the line', function() setup(clear) diff --git a/test/functional/legacy/029_join_spec.lua b/test/functional/legacy/029_join_spec.lua index c808a21afc..c3ca29170f 100644 --- a/test/functional/legacy/029_join_spec.lua +++ b/test/functional/legacy/029_join_spec.lua @@ -1,12 +1,12 @@ -- Test for joining lines with marks in them (and with 'joinspaces' set/reset) -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local feed = helpers.feed -local clear = helpers.clear -local insert = helpers.insert -local expect = helpers.expect -local feed_command = helpers.feed_command +local feed = t.feed +local clear = t.clear +local insert = t.insert +local expect = t.expect +local feed_command = t.feed_command describe('joining lines', function() before_each(clear) diff --git a/test/functional/legacy/030_fileformats_spec.lua b/test/functional/legacy/030_fileformats_spec.lua index e88afd9c47..8edcd2a7f9 100644 --- a/test/functional/legacy/030_fileformats_spec.lua +++ b/test/functional/legacy/030_fileformats_spec.lua @@ -1,9 +1,9 @@ -- Test for a lot of variations of the 'fileformats' option -local helpers = require('test.functional.helpers')(after_each) -local feed, clear, command = helpers.feed, helpers.clear, helpers.command -local eq, write_file = helpers.eq, helpers.write_file -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local feed, clear, command = t.feed, t.clear, t.command +local eq, write_file = t.eq, t.write_file +local poke_eventloop = t.poke_eventloop describe('fileformats option', function() setup(function() @@ -254,7 +254,7 @@ describe('fileformats option', function() command('set nobinary ff&') -- Assert buffer contents. This has to be done manually as - -- helpers.expect() calls helpers.dedent() which messes up the white space + -- t.expect() calls t.dedent() which messes up the white space -- and carriage returns. eq( 'unix\n'.. @@ -387,6 +387,6 @@ describe('fileformats option', function() '10\n'.. 'unix\n'.. 'unix', - helpers.curbuf_contents()) + t.curbuf_contents()) end) end) diff --git a/test/functional/legacy/031_close_commands_spec.lua b/test/functional/legacy/031_close_commands_spec.lua index 173ebf1cf4..f9d45c7788 100644 --- a/test/functional/legacy/031_close_commands_spec.lua +++ b/test/functional/legacy/031_close_commands_spec.lua @@ -9,15 +9,15 @@ -- :buf -- :edit -local helpers = require('test.functional.helpers')(after_each) - -local feed = helpers.feed -local clear = helpers.clear -local source = helpers.source -local insert = helpers.insert -local expect = helpers.expect -local feed_command = helpers.feed_command -local expect_exit = helpers.expect_exit +local t = require('test.functional.testutil')(after_each) + +local feed = t.feed +local clear = t.clear +local source = t.source +local insert = t.insert +local expect = t.expect +local feed_command = t.feed_command +local expect_exit = t.expect_exit describe('Commands that close windows and/or buffers', function() local function cleanup() diff --git a/test/functional/legacy/033_lisp_indent_spec.lua b/test/functional/legacy/033_lisp_indent_spec.lua index b27de6c16d..e2f6e2ee8f 100644 --- a/test/functional/legacy/033_lisp_indent_spec.lua +++ b/test/functional/legacy/033_lisp_indent_spec.lua @@ -1,10 +1,10 @@ -- Test for 'lisp' -- If the lisp feature is not enabled, this will fail! -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, expect = helpers.command, helpers.expect -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local command, expect = t.command, t.expect +local poke_eventloop = t.poke_eventloop describe('lisp indent', function() setup(clear) diff --git a/test/functional/legacy/034_user_function_spec.lua b/test/functional/legacy/034_user_function_spec.lua index c30c7275f2..b93bd45068 100644 --- a/test/functional/legacy/034_user_function_spec.lua +++ b/test/functional/legacy/034_user_function_spec.lua @@ -3,9 +3,9 @@ -- Also test that a builtin function cannot be replaced. -- Also test for regression when calling arbitrary expression. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert, source = t.feed, t.insert, t.source +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe( 'user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions', diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua index 84eb9c0eee..8d2564cb6e 100644 --- a/test/functional/legacy/035_increment_and_decrement_spec.lua +++ b/test/functional/legacy/035_increment_and_decrement_spec.lua @@ -1,9 +1,9 @@ -- Test Ctrl-A and Ctrl-X, which increment and decrement decimal, hexadecimal, -- and octal numbers. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('increment and decrement commands', function() setup(clear) diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua index ed35b2b245..4fb902440d 100644 --- a/test/functional/legacy/036_regexp_character_classes_spec.lua +++ b/test/functional/legacy/036_regexp_character_classes_spec.lua @@ -1,8 +1,8 @@ -- Test character classes in regexp using regexpengine 0, 1, 2. -local helpers = require('test.functional.helpers')(after_each) -local clear, command, expect = helpers.clear, helpers.command, helpers.expect -local source, write_file = helpers.source, helpers.write_file +local t = require('test.functional.testutil')(after_each) +local clear, command, expect = t.clear, t.command, t.expect +local source, write_file = t.source, t.write_file local function sixlines(text) local result = '' @@ -13,14 +13,14 @@ local function sixlines(text) end local function diff(text, nodedent) - local fname = helpers.tmpname() + local fname = t.tmpname() command('w! ' .. fname) - helpers.poke_eventloop() + t.poke_eventloop() local data = io.open(fname):read('*all') if nodedent then - helpers.eq(text, data) + t.eq(text, data) else - helpers.eq(helpers.dedent(text), data) + t.eq(t.dedent(text), data) end os.remove(fname) end diff --git a/test/functional/legacy/038_virtual_replace_spec.lua b/test/functional/legacy/038_virtual_replace_spec.lua index 2f85e7d5a3..abc6c03234 100644 --- a/test/functional/legacy/038_virtual_replace_spec.lua +++ b/test/functional/legacy/038_virtual_replace_spec.lua @@ -1,8 +1,8 @@ -- Test Virtual replace mode. -local helpers = require('test.functional.helpers')(after_each) -local feed = helpers.feed -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed = t.feed +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('Virtual replace mode', function() setup(clear) diff --git a/test/functional/legacy/039_visual_block_mode_commands_spec.lua b/test/functional/legacy/039_visual_block_mode_commands_spec.lua index bc3fea765c..b0f6eff851 100644 --- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua +++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua @@ -1,11 +1,11 @@ -- Test Visual block mode commands -- And test "U" in Visual mode, also on German sharp S. -local helpers = require('test.functional.helpers')(after_each) -local nvim, eq = helpers.api, helpers.eq -local insert, feed = helpers.insert, helpers.feed -local clear, expect = helpers.clear, helpers.expect -local feed_command = helpers.feed_command +local t = require('test.functional.testutil')(after_each) +local nvim, eq = t.api, t.eq +local insert, feed = t.insert, t.feed +local clear, expect = t.clear, t.expect +local feed_command = t.feed_command describe('Visual block mode', function() before_each(function() diff --git a/test/functional/legacy/043_magic_settings_spec.lua b/test/functional/legacy/043_magic_settings_spec.lua index a88ccc2b42..c45c8ac6ee 100644 --- a/test/functional/legacy/043_magic_settings_spec.lua +++ b/test/functional/legacy/043_magic_settings_spec.lua @@ -1,8 +1,8 @@ -- Tests for regexp with various magic settings. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('regexp with magic settings', function() setup(clear) diff --git a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua index 074ee094b4..a8de7784e8 100644 --- a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua +++ b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua @@ -3,9 +3,9 @@ -- -- This test contains both "test44" and "test99" from the old test suite. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect -- Runs the test protocol with the given 'regexpengine' setting. In the old test -- suite the test protocol was duplicated in test44 and test99, the only diff --git a/test/functional/legacy/046_multi_line_regexps_spec.lua b/test/functional/legacy/046_multi_line_regexps_spec.lua index 30ec76ea3e..2392cdd5b0 100644 --- a/test/functional/legacy/046_multi_line_regexps_spec.lua +++ b/test/functional/legacy/046_multi_line_regexps_spec.lua @@ -1,9 +1,9 @@ -- vim: set foldmethod=marker foldmarker=[[,]] : -- Tests for multi-line regexps with ":s" -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local expect = helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local expect = t.expect describe('multi-line regexp', function() setup(clear) diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua index c8b9dfa98f..357f8bf134 100644 --- a/test/functional/legacy/054_buffer_local_autocommands_spec.lua +++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua @@ -1,10 +1,10 @@ -- Some tests for buffer-local autocommands -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local expect = helpers.expect -local command = helpers.command +local clear = t.clear +local expect = t.expect +local command = t.command local fname = 'Xtest-functional-legacy-054' diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua index e8ae60e350..fad9826520 100644 --- a/test/functional/legacy/055_list_and_dict_types_spec.lua +++ b/test/functional/legacy/055_list_and_dict_types_spec.lua @@ -1,8 +1,8 @@ -- Tests for List and Dictionary types. -local helpers = require('test.functional.helpers')(after_each) -local feed, source = helpers.feed, helpers.source -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, source = t.feed, t.source +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('list and dictionary types', function() before_each(clear) diff --git a/test/functional/legacy/056_script_local_function_spec.lua b/test/functional/legacy/056_script_local_function_spec.lua index 084817ad7a..d1aa76130d 100644 --- a/test/functional/legacy/056_script_local_function_spec.lua +++ b/test/functional/legacy/056_script_local_function_spec.lua @@ -1,9 +1,9 @@ -- vim: set foldmethod=marker foldmarker=[[,]] : -- Test for script-local function. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local expect = helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local expect = t.expect describe('source function', function() setup(clear) diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua index 9b4746591f..d34ebffd0d 100644 --- a/test/functional/legacy/057_sort_spec.lua +++ b/test/functional/legacy/057_sort_spec.lua @@ -1,10 +1,10 @@ -- Tests for :sort command. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local insert, command, clear, expect, eq, poke_eventloop = - helpers.insert, helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.poke_eventloop -local exc_exec = helpers.exc_exec + t.insert, t.command, t.clear, t.expect, t.eq, t.poke_eventloop +local exc_exec = t.exc_exec describe(':sort', function() local text = [[ diff --git a/test/functional/legacy/060_exists_and_has_functions_spec.lua b/test/functional/legacy/060_exists_and_has_functions_spec.lua index 82fece3e84..4fa663477c 100644 --- a/test/functional/legacy/060_exists_and_has_functions_spec.lua +++ b/test/functional/legacy/060_exists_and_has_functions_spec.lua @@ -1,9 +1,9 @@ -- Tests for the exists() and has() functions. -local helpers = require('test.functional.helpers')(after_each) -local source = helpers.source -local clear, expect = helpers.clear, helpers.expect -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) +local source = t.source +local clear, expect = t.clear, t.expect +local write_file = t.write_file describe('exists() and has() functions', function() setup(function() diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua index b5af8f7d52..da065f30b0 100644 --- a/test/functional/legacy/061_undo_tree_spec.lua +++ b/test/functional/legacy/061_undo_tree_spec.lua @@ -1,18 +1,18 @@ -- Tests for undo tree and :earlier and :later. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local feed_command = helpers.feed_command -local write_file = helpers.write_file -local command = helpers.command -local source = helpers.source -local expect = helpers.expect -local clear = helpers.clear -local feed = helpers.feed -local eval = helpers.eval -local eq = helpers.eq +local feed_command = t.feed_command +local write_file = t.write_file +local command = t.command +local source = t.source +local expect = t.expect +local clear = t.clear +local feed = t.feed +local eval = t.eval +local eq = t.eq local function expect_empty_buffer() - -- The space will be removed by helpers.dedent but is needed because dedent + -- The space will be removed by t.dedent but is needed because dedent -- will fail if it can not find the common indent of the given lines. return expect(' ') end @@ -99,7 +99,7 @@ describe('undo tree:', function() expect_line('123456abc') end - helpers.retry(2, nil, test_earlier_later) + t.retry(2, nil, test_earlier_later) end) it('file-write specifications', function() diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua index b875d32e56..c36a0e0368 100644 --- a/test/functional/legacy/063_match_and_matchadd_spec.lua +++ b/test/functional/legacy/063_match_and_matchadd_spec.lua @@ -1,10 +1,10 @@ -- Tests for adjusting window and contents -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, command = helpers.clear, helpers.command -local insert = helpers.insert +local clear, command = t.clear, t.command +local insert = t.insert describe('063: Test for ":match", "matchadd()" and related functions', function() setup(clear) diff --git a/test/functional/legacy/065_float_and_logic_operators_spec.lua b/test/functional/legacy/065_float_and_logic_operators_spec.lua index ad1b004085..d9920ac20b 100644 --- a/test/functional/legacy/065_float_and_logic_operators_spec.lua +++ b/test/functional/legacy/065_float_and_logic_operators_spec.lua @@ -1,8 +1,8 @@ -- Test for floating point and logical operators. -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, expect = helpers.clear, helpers.expect +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, expect = t.clear, t.expect describe('floating point and logical operators', function() setup(clear) diff --git a/test/functional/legacy/066_visual_block_tab_spec.lua b/test/functional/legacy/066_visual_block_tab_spec.lua index f10152d8ea..65e756f13e 100644 --- a/test/functional/legacy/066_visual_block_tab_spec.lua +++ b/test/functional/legacy/066_visual_block_tab_spec.lua @@ -1,9 +1,9 @@ -- vim: set foldmethod=marker foldmarker=[[,]] : -- Test for visual block shift and tab characters. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('visual block shift and tab characters', function() setup(clear) diff --git a/test/functional/legacy/067_augroup_exists_spec.lua b/test/functional/legacy/067_augroup_exists_spec.lua index 4a77bf838a..15db32566b 100644 --- a/test/functional/legacy/067_augroup_exists_spec.lua +++ b/test/functional/legacy/067_augroup_exists_spec.lua @@ -1,9 +1,9 @@ -- Test that groups and patterns are tested correctly when calling exists() for -- autocommands. -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command, expect = helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command, expect = t.command, t.expect describe('augroup when calling exists()', function() setup(clear) diff --git a/test/functional/legacy/068_text_formatting_spec.lua b/test/functional/legacy/068_text_formatting_spec.lua index 3a1b21bf87..a74df07311 100644 --- a/test/functional/legacy/068_text_formatting_spec.lua +++ b/test/functional/legacy/068_text_formatting_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local feed = helpers.feed -local clear = helpers.clear -local insert = helpers.insert -local feed_command = helpers.feed_command -local expect = helpers.expect +local feed = t.feed +local clear = t.clear +local insert = t.insert +local feed_command = t.feed_command +local expect = t.expect describe('text formatting', function() setup(clear) diff --git a/test/functional/legacy/069_multibyte_formatting_spec.lua b/test/functional/legacy/069_multibyte_formatting_spec.lua index 05e6aa1435..321c718fe2 100644 --- a/test/functional/legacy/069_multibyte_formatting_spec.lua +++ b/test/functional/legacy/069_multibyte_formatting_spec.lua @@ -3,15 +3,9 @@ -- And test "ra" on multibyte characters. -- Also test byteidx() and byteidxcomp() -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local feed, insert, eq, eval, clear, feed_command, expect = - helpers.feed, - helpers.insert, - helpers.eq, - helpers.eval, - helpers.clear, - helpers.feed_command, - helpers.expect + t.feed, t.insert, t.eq, t.eval, t.clear, t.feed_command, t.expect describe('multibyte text', function() before_each(clear) diff --git a/test/functional/legacy/072_undo_file_spec.lua b/test/functional/legacy/072_undo_file_spec.lua index 80665027c3..a9eb93b31d 100644 --- a/test/functional/legacy/072_undo_file_spec.lua +++ b/test/functional/legacy/072_undo_file_spec.lua @@ -2,9 +2,9 @@ -- Since this script is sourced we need to explicitly break changes up in -- undo-able pieces. Do that by setting 'undolevels'. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('72', function() setup(clear) diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua index 0a9ad330c2..81f3d4c3b1 100644 --- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua +++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua @@ -1,8 +1,8 @@ -- Tests for storing global variables in the .shada file -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local clear, command, eq, neq, eval, poke_eventloop = - helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval, helpers.poke_eventloop + t.clear, t.command, t.eq, t.neq, t.eval, t.poke_eventloop describe('storing global variables in ShaDa files', function() local tempname = 'Xtest-functional-legacy-074' diff --git a/test/functional/legacy/078_swapfile_recover_spec.lua b/test/functional/legacy/078_swapfile_recover_spec.lua index dc5b1a8540..6ee9a061bf 100644 --- a/test/functional/legacy/078_swapfile_recover_spec.lua +++ b/test/functional/legacy/078_swapfile_recover_spec.lua @@ -3,8 +3,8 @@ -- restored. We need about 10000 lines of 100 characters to get two levels of -- pointer blocks. -local helpers = require('test.functional.helpers')(after_each) -local clear, expect, source = helpers.clear, helpers.expect, helpers.source +local t = require('test.functional.testutil')(after_each) +local clear, expect, source = t.clear, t.expect, t.source describe('78', function() setup(clear) diff --git a/test/functional/legacy/081_coptions_movement_spec.lua b/test/functional/legacy/081_coptions_movement_spec.lua index d82c46a3d3..bf477c66fc 100644 --- a/test/functional/legacy/081_coptions_movement_spec.lua +++ b/test/functional/legacy/081_coptions_movement_spec.lua @@ -1,8 +1,8 @@ -- Test for t movement command and 'cpo-;' setting -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('coptions', function() setup(clear) diff --git a/test/functional/legacy/082_string_comparison_spec.lua b/test/functional/legacy/082_string_comparison_spec.lua index 311822c34f..83d7179014 100644 --- a/test/functional/legacy/082_string_comparison_spec.lua +++ b/test/functional/legacy/082_string_comparison_spec.lua @@ -1,9 +1,9 @@ -- Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c) -- Also test "g~ap". -local helpers = require('test.functional.helpers')(after_each) -local feed, source = helpers.feed, helpers.source -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, source = t.feed, t.source +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('case-insensitive string comparison in UTF-8', function() setup(clear) diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua index 5e9c131c64..3c5d1d38d8 100644 --- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua +++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua @@ -1,12 +1,12 @@ -- Tests for tag search with !_TAG_FILE_ENCODING. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local insert, source, clear, expect, write_file = - helpers.insert, helpers.source, helpers.clear, helpers.expect, helpers.write_file + t.insert, t.source, t.clear, t.expect, t.write_file local function has_iconv() clear() -- ensures session - return 1 == helpers.eval('has("iconv")') + return 1 == t.eval('has("iconv")') end describe('tag search with !_TAG_FILE_ENCODING', function() @@ -31,7 +31,7 @@ describe('tag search with !_TAG_FILE_ENCODING', function() ) -- The last file is very long but repetitive and can be generated on the -- fly. - local text = helpers.dedent([[ + local text = t.dedent([[ !_TAG_FILE_SORTED 1 // !_TAG_FILE_ENCODING cp932 // ]]) diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua index 701b777df1..29c3560caa 100644 --- a/test/functional/legacy/090_sha256_spec.lua +++ b/test/functional/legacy/090_sha256_spec.lua @@ -1,8 +1,8 @@ -- Tests for sha256() function. -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, expect = helpers.clear, helpers.expect +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, expect = t.clear, t.expect describe('sha256()', function() setup(clear) diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua index 3b9fdf740f..e9f8458f80 100644 --- a/test/functional/legacy/091_context_variables_spec.lua +++ b/test/functional/legacy/091_context_variables_spec.lua @@ -1,8 +1,8 @@ -- Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, expect = helpers.clear, helpers.expect +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, expect = t.clear, t.expect describe('context variables', function() setup(clear) diff --git a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua index 3c46c29951..6e12c61d9d 100644 --- a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua +++ b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua @@ -3,9 +3,9 @@ -- -- Same as legacy test 93 but using UTF-8 file encoding. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('store cursor position in session file in UTF-8', function() setup(clear) diff --git a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua index f09fd9a6e5..a3b1a01a8c 100644 --- a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua +++ b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua @@ -3,9 +3,9 @@ -- -- Same as legacy test 92 but using Latin-1 file encoding. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('store cursor position in session file in Latin-1', function() setup(clear) diff --git a/test/functional/legacy/094_visual_mode_operators_spec.lua b/test/functional/legacy/094_visual_mode_operators_spec.lua index ff1d3e7bec..44f3cbecf2 100644 --- a/test/functional/legacy/094_visual_mode_operators_spec.lua +++ b/test/functional/legacy/094_visual_mode_operators_spec.lua @@ -4,9 +4,9 @@ -- followed by an operator and those executed via Operator-pending mode. Also -- part of the test are mappings, counts, and repetition with the . command. -local helpers = require('test.functional.helpers')(after_each) -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert, source = t.feed, t.insert, t.source +local clear, feed_command, expect = t.clear, t.feed_command, t.expect -- Vim script user functions needed for some of the test cases. local function source_user_functions() diff --git a/test/functional/legacy/095_regexp_multibyte_spec.lua b/test/functional/legacy/095_regexp_multibyte_spec.lua index fad0dc8023..25524721ab 100644 --- a/test/functional/legacy/095_regexp_multibyte_spec.lua +++ b/test/functional/legacy/095_regexp_multibyte_spec.lua @@ -3,9 +3,9 @@ -- A pattern that gives the expected result produces OK, so that we know it was -- actually tried. -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, expect = helpers.clear, helpers.expect +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, expect = t.clear, t.expect describe('regex with multi-byte', function() setup(clear) diff --git a/test/functional/legacy/096_location_list_spec.lua b/test/functional/legacy/096_location_list_spec.lua index 2817d5d240..e105664522 100644 --- a/test/functional/legacy/096_location_list_spec.lua +++ b/test/functional/legacy/096_location_list_spec.lua @@ -6,9 +6,9 @@ -- C. make sure that the location list window is not reused instead of the window -- it belongs to. -local helpers = require('test.functional.helpers')(after_each) -local source = helpers.source -local clear, command, expect = helpers.clear, helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local source = t.source +local clear, command, expect = t.clear, t.command, t.expect describe('location list', function() local test_file = 'Xtest-096_location_list.out' diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua index b335b3bf41..d2d68cc35d 100644 --- a/test/functional/legacy/097_glob_path_spec.lua +++ b/test/functional/legacy/097_glob_path_spec.lua @@ -2,15 +2,15 @@ -- Test whether glob()/globpath() return correct results with certain escaped -- characters. -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command, expect = helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command, expect = t.command, t.expect describe('glob() and globpath()', function() setup(clear) setup(function() - if helpers.is_os('win') then + if t.is_os('win') then os.execute('md sautest\\autoload') os.execute('.>sautest\\autoload\\Test104.vim 2>nul') os.execute('.>sautest\\autoload\\footest.vim 2>nul') @@ -28,7 +28,7 @@ describe('glob() and globpath()', function() -- Consistent sorting of file names command('set nofileignorecase') - if helpers.is_os('win') then + if t.is_os('win') then command([[$put =glob('Xxx{')]]) command([[$put =glob('Xxx$')]]) @@ -72,7 +72,7 @@ describe('glob() and globpath()', function() end) teardown(function() - if helpers.is_os('win') then + if t.is_os('win') then os.execute('del /q/f Xxx{ Xxx$') os.execute('rd /q /s sautest') else diff --git a/test/functional/legacy/101_hlsearch_spec.lua b/test/functional/legacy/101_hlsearch_spec.lua index eff755221c..c76c295eae 100644 --- a/test/functional/legacy/101_hlsearch_spec.lua +++ b/test/functional/legacy/101_hlsearch_spec.lua @@ -1,8 +1,8 @@ -- Test for v:hlsearch -local helpers = require('test.functional.helpers')(after_each) -local clear, feed = helpers.clear, helpers.feed -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed = t.clear, t.feed +local feed_command, expect = t.feed_command, t.expect describe('v:hlsearch', function() setup(clear) diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua index 11bdbd7c9c..651c6fa41d 100644 --- a/test/functional/legacy/102_fnameescape_spec.lua +++ b/test/functional/legacy/102_fnameescape_spec.lua @@ -1,8 +1,8 @@ -- Test if fnameescape is correct for special chars like! -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command, expect = helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command, expect = t.command, t.expect describe('fnameescape', function() setup(clear) diff --git a/test/functional/legacy/103_visual_mode_reset_spec.lua b/test/functional/legacy/103_visual_mode_reset_spec.lua index f5cd861019..2f43a0e8cd 100644 --- a/test/functional/legacy/103_visual_mode_reset_spec.lua +++ b/test/functional/legacy/103_visual_mode_reset_spec.lua @@ -1,8 +1,8 @@ -- Test for visual mode not being reset causing E315 error. -local helpers = require('test.functional.helpers')(after_each) -local feed, source = helpers.feed, helpers.source -local clear, expect = helpers.clear, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, source = t.feed, t.source +local clear, expect = t.clear, t.expect describe('E315 error', function() setup(clear) diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua index 2a83d48c07..cdbf9b9c5b 100644 --- a/test/functional/legacy/106_errorformat_spec.lua +++ b/test/functional/legacy/106_errorformat_spec.lua @@ -1,8 +1,8 @@ -- Tests for errorformat. -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command, expect = helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command, expect = t.command, t.expect describe('errorformat', function() setup(clear) diff --git a/test/functional/legacy/107_adjust_window_and_contents_spec.lua b/test/functional/legacy/107_adjust_window_and_contents_spec.lua index f4d9d375b3..ec5a3e8443 100644 --- a/test/functional/legacy/107_adjust_window_and_contents_spec.lua +++ b/test/functional/legacy/107_adjust_window_and_contents_spec.lua @@ -1,12 +1,12 @@ -- Tests for adjusting window and contents -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local poke_eventloop = helpers.poke_eventloop -local clear = helpers.clear -local insert = helpers.insert -local command = helpers.command +local poke_eventloop = t.poke_eventloop +local clear = t.clear +local insert = t.insert +local command = t.command describe('107', function() setup(clear) diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua index ccdd0cd2be..ae63244c00 100644 --- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua +++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua @@ -1,9 +1,9 @@ -- Tests for backtrace debug commands. -local helpers = require('test.functional.helpers')(after_each) -local command = helpers.command -local feed, clear = helpers.feed, helpers.clear -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local command = t.command +local feed, clear = t.feed, t.clear +local feed_command, expect = t.feed_command, t.expect describe('108', function() before_each(clear) diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua index d1764d9702..bdcac04da3 100644 --- a/test/functional/legacy/arglist_spec.lua +++ b/test/functional/legacy/arglist_spec.lua @@ -1,11 +1,11 @@ -- Test argument list commands -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, command, eq = helpers.clear, helpers.command, helpers.eq -local expect_exit = helpers.expect_exit -local feed = helpers.feed -local pcall_err = helpers.pcall_err +local clear, command, eq = t.clear, t.command, t.eq +local expect_exit = t.expect_exit +local feed = t.feed +local pcall_err = t.pcall_err describe('argument list commands', function() before_each(clear) diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua index 04c90281a7..14b9e2d636 100644 --- a/test/functional/legacy/assert_spec.lua +++ b/test/functional/legacy/assert_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local nvim, call = helpers.api, helpers.call -local clear, eq = helpers.clear, helpers.eq -local source, command = helpers.source, helpers.command -local exc_exec = helpers.exc_exec -local eval = helpers.eval +local t = require('test.functional.testutil')(after_each) +local nvim, call = t.api, t.call +local clear, eq = t.clear, t.eq +local source, command = t.source, t.command +local exc_exec = t.exc_exec +local eval = t.eval local function expected_errors(errors) eq(errors, nvim.nvim_get_vvar('errors')) diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua index e5980f5942..84fb897d5b 100644 --- a/test/functional/legacy/autochdir_spec.lua +++ b/test/functional/legacy/autochdir_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, matches = helpers.clear, helpers.eq, helpers.matches -local eval, command, call, api = helpers.eval, helpers.command, helpers.call, helpers.api -local source, exec_capture = helpers.source, helpers.exec_capture -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) +local clear, eq, matches = t.clear, t.eq, t.matches +local eval, command, call, api = t.eval, t.command, t.call, t.api +local source, exec_capture = t.source, t.exec_capture +local mkdir = t.mkdir local function expected_empty() eq({}, api.nvim_get_vvar('errors')) @@ -18,7 +18,7 @@ describe('autochdir behavior', function() end) after_each(function() - helpers.rmdir(dir) + t.rmdir(dir) end) -- Tests vim/vim#777 without test_autochdir(). diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua index 9966df263b..4b919db9ce 100644 --- a/test/functional/legacy/autocmd_option_spec.lua +++ b/test/functional/legacy/autocmd_option_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local nvim = helpers.api -local clear, eq, neq, eval = helpers.clear, helpers.eq, helpers.neq, helpers.eval -local api = helpers.api -local curbuf = helpers.api.nvim_get_current_buf -local curwin = helpers.api.nvim_get_current_win -local exec_capture = helpers.exec_capture -local source, command = helpers.source, helpers.command +local t = require('test.functional.testutil')(after_each) +local nvim = t.api +local clear, eq, neq, eval = t.clear, t.eq, t.neq, t.eval +local api = t.api +local curbuf = t.api.nvim_get_current_buf +local curwin = t.api.nvim_get_current_win +local exec_capture = t.exec_capture +local source, command = t.source, t.command local function declare_hook_function() source([[ diff --git a/test/functional/legacy/autocmd_spec.lua b/test/functional/legacy/autocmd_spec.lua index 97051f3d3f..bc0c0cd556 100644 --- a/test/functional/legacy/autocmd_spec.lua +++ b/test/functional/legacy/autocmd_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local write_file = helpers.write_file -local command = helpers.command -local feed = helpers.feed -local api = helpers.api -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local write_file = t.write_file +local command = t.command +local feed = t.feed +local api = t.api +local eq = t.eq before_each(clear) diff --git a/test/functional/legacy/autoformat_join_spec.lua b/test/functional/legacy/autoformat_join_spec.lua index 22b1c258fe..32465a91cd 100644 --- a/test/functional/legacy/autoformat_join_spec.lua +++ b/test/functional/legacy/autoformat_join_spec.lua @@ -1,9 +1,9 @@ -- Tests for setting the '[,'] marks when joining lines. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, expect = helpers.command, helpers.expect -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local command, expect = t.command, t.expect +local poke_eventloop = t.poke_eventloop describe('autoformat join', function() setup(clear) diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua index dd18e5664b..b6deaae6b5 100644 --- a/test/functional/legacy/breakindent_spec.lua +++ b/test/functional/legacy/breakindent_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local command = t.command +local exec = t.exec +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua index b673e74128..4cf8c9bcdb 100644 --- a/test/functional/legacy/changelist_spec.lua +++ b/test/functional/legacy/changelist_spec.lua @@ -1,9 +1,9 @@ -- Test changelist position after splitting window -- Set 'undolevels' to make changelist for sourced file -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('changelist', function() setup(clear) diff --git a/test/functional/legacy/charsearch_spec.lua b/test/functional/legacy/charsearch_spec.lua index c1a59c9ee1..b228460528 100644 --- a/test/functional/legacy/charsearch_spec.lua +++ b/test/functional/legacy/charsearch_spec.lua @@ -1,8 +1,8 @@ -- Test for character searches -local helpers = require('test.functional.helpers')(after_each) -local feed, insert = helpers.feed, helpers.insert -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert = t.feed, t.insert +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('charsearch', function() setup(clear) diff --git a/test/functional/legacy/close_count_spec.lua b/test/functional/legacy/close_count_spec.lua index 930dae668a..4f81026fb2 100644 --- a/test/functional/legacy/close_count_spec.lua +++ b/test/functional/legacy/close_count_spec.lua @@ -1,13 +1,13 @@ -- Tests for :[count]close! and :[count]hide -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local poke_eventloop = helpers.poke_eventloop -local eval = helpers.eval -local feed = helpers.feed -local clear = helpers.clear -local command = helpers.command +local eq = t.eq +local poke_eventloop = t.poke_eventloop +local eval = t.eval +local feed = t.feed +local clear = t.clear +local command = t.command describe('close_count', function() setup(clear) diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 6b9f746826..4a5f1b1b61 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed -local feed_command = helpers.feed_command -local exec = helpers.exec -local api = helpers.api +local clear = t.clear +local command = t.command +local feed = t.feed +local feed_command = t.feed_command +local exec = t.exec +local api = t.api local pesc = vim.pesc describe('cmdline', function() diff --git a/test/functional/legacy/command_count_spec.lua b/test/functional/legacy/command_count_spec.lua index 8707c0459c..7e10711e0b 100644 --- a/test/functional/legacy/command_count_spec.lua +++ b/test/functional/legacy/command_count_spec.lua @@ -1,8 +1,8 @@ -- Test for user command counts -local helpers = require('test.functional.helpers')(after_each) -local clear, source, expect = helpers.clear, helpers.source, helpers.expect -local feed_command = helpers.feed_command +local t = require('test.functional.testutil')(after_each) +local clear, source, expect = t.clear, t.source, t.expect +local feed_command = t.feed_command -- luacheck: ignore 613 (Trailing whitespace in a string) describe('command_count', function() diff --git a/test/functional/legacy/comparators_spec.lua b/test/functional/legacy/comparators_spec.lua index 32e830a0af..055b260be1 100644 --- a/test/functional/legacy/comparators_spec.lua +++ b/test/functional/legacy/comparators_spec.lua @@ -1,8 +1,8 @@ -- " Test for expression comparators. -local helpers = require('test.functional.helpers')(after_each) -local clear, eq = helpers.clear, helpers.eq -local eval, command = helpers.eval, helpers.command +local t = require('test.functional.testutil')(after_each) +local clear, eq = t.clear, t.eq +local eval, command = t.eval, t.command describe('comparators', function() before_each(clear) diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua index a28c3058b2..287ccd10ff 100644 --- a/test/functional/legacy/conceal_spec.lua +++ b/test/functional/legacy/conceal_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api +local clear = t.clear +local command = t.command +local exec = t.exec +local feed = t.feed +local api = t.api local expect_pos = function(row, col) - return helpers.eq({ row, col }, helpers.eval('[screenrow(), screencol()]')) + return t.eq({ row, col }, t.eval('[screenrow(), screencol()]')) end describe('Conceal', function() diff --git a/test/functional/legacy/cpoptions_spec.lua b/test/functional/legacy/cpoptions_spec.lua index b8ecb5665d..74328ad353 100644 --- a/test/functional/legacy/cpoptions_spec.lua +++ b/test/functional/legacy/cpoptions_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed +local clear = t.clear +local command = t.command +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/crash_spec.lua b/test/functional/legacy/crash_spec.lua index 094bea253e..66ca61fb67 100644 --- a/test/functional/legacy/crash_spec.lua +++ b/test/functional/legacy/crash_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local assert_alive = t.assert_alive +local clear = t.clear +local command = t.command +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/debugger_spec.lua b/test/functional/legacy/debugger_spec.lua index 6d8547ead1..2d682d5073 100644 --- a/test/functional/legacy/debugger_spec.lua +++ b/test/functional/legacy/debugger_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed -local write_file = helpers.write_file +local clear = t.clear +local command = t.command +local feed = t.feed +local write_file = t.write_file before_each(clear) diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua index 1227065af2..4cf3893e01 100644 --- a/test/functional/legacy/delete_spec.lua +++ b/test/functional/legacy/delete_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, source = helpers.clear, helpers.source -local eq, eval, command = helpers.eq, helpers.eval, helpers.command -local exc_exec = helpers.exc_exec +local t = require('test.functional.testutil')(after_each) +local clear, source = t.clear, t.source +local eq, eval, command = t.eq, t.eval, t.command +local exc_exec = t.exc_exec describe('Test for delete()', function() before_each(clear) @@ -48,7 +48,7 @@ describe('Test for delete()', function() it('symlink directory delete', function() command("call mkdir('Xdir1')") - if helpers.is_os('win') then + if t.is_os('win') then command('silent !mklink /j Xlink Xdir1') else command('silent !ln -s Xdir1 Xlink') diff --git a/test/functional/legacy/digraph_spec.lua b/test/functional/legacy/digraph_spec.lua index f11043bd10..5ee899d859 100644 --- a/test/functional/legacy/digraph_spec.lua +++ b/test/functional/legacy/digraph_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local feed = helpers.feed +local clear = t.clear +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua index 37e063e0cd..90a2860083 100644 --- a/test/functional/legacy/display_spec.lua +++ b/test/functional/legacy/display_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed -local command = helpers.command +local clear = t.clear +local exec = t.exec +local feed = t.feed +local command = t.command describe('display', function() before_each(clear) diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua index 056ec78397..86cce91e76 100644 --- a/test/functional/legacy/edit_spec.lua +++ b/test/functional/legacy/edit_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local expect = helpers.expect -local feed = helpers.feed +local clear = t.clear +local command = t.command +local expect = t.expect +local feed = t.feed local sleep = vim.uv.sleep before_each(clear) diff --git a/test/functional/legacy/erasebackword_spec.lua b/test/functional/legacy/erasebackword_spec.lua index 46057fe599..44d93db125 100644 --- a/test/functional/legacy/erasebackword_spec.lua +++ b/test/functional/legacy/erasebackword_spec.lua @@ -1,7 +1,7 @@ -- Test for CTRL-W in Insert mode -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, expect = helpers.clear, helpers.feed, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, expect = t.clear, t.feed, t.expect describe('CTRL-W in Insert mode', function() setup(clear) diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua index 21d0ce118d..d0bbda437a 100644 --- a/test/functional/legacy/eval_spec.lua +++ b/test/functional/legacy/eval_spec.lua @@ -1,13 +1,13 @@ -- Test for various eval features. -local helpers = require('test.functional.helpers')(after_each) -local assert_alive = helpers.assert_alive -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, command, expect = helpers.clear, helpers.command, helpers.expect -local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file -local poke_eventloop = helpers.poke_eventloop -local exc_exec = helpers.exc_exec -local dedent = helpers.dedent +local t = require('test.functional.testutil')(after_each) +local assert_alive = t.assert_alive +local feed, insert, source = t.feed, t.insert, t.source +local clear, command, expect = t.clear, t.command, t.expect +local eq, eval, write_file = t.eq, t.eval, t.write_file +local poke_eventloop = t.poke_eventloop +local exc_exec = t.exc_exec +local dedent = t.dedent describe('eval', function() setup(function() diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua index 404f9675be..bf173a9712 100644 --- a/test/functional/legacy/ex_mode_spec.lua +++ b/test/functional/legacy/ex_mode_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local api = helpers.api -local poke_eventloop = helpers.poke_eventloop +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed +local api = t.api +local poke_eventloop = t.poke_eventloop before_each(clear) diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua index f23646eb91..7b282a7890 100644 --- a/test/functional/legacy/excmd_spec.lua +++ b/test/functional/legacy/excmd_spec.lua @@ -1,18 +1,18 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local expect_exit = helpers.expect_exit -local feed = helpers.feed -local fn = helpers.fn -local api = helpers.api -local read_file = helpers.read_file -local source = helpers.source -local eq = helpers.eq -local write_file = helpers.write_file -local is_os = helpers.is_os +local clear = t.clear +local command = t.command +local exec = t.exec +local exec_lua = t.exec_lua +local expect_exit = t.expect_exit +local feed = t.feed +local fn = t.fn +local api = t.api +local read_file = t.read_file +local source = t.source +local eq = t.eq +local write_file = t.write_file +local is_os = t.is_os local function sizeoflong() if not exec_lua('return pcall(require, "ffi")') then diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua index 01b87ac9a0..5b6c34c7ae 100644 --- a/test/functional/legacy/fixeol_spec.lua +++ b/test/functional/legacy/fixeol_spec.lua @@ -1,8 +1,8 @@ -- Tests for 'fixeol' -local helpers = require('test.functional.helpers')(after_each) -local feed = helpers.feed -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed = t.feed +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('fixeol', function() local function rmtestfiles() diff --git a/test/functional/legacy/fnamemodify_spec.lua b/test/functional/legacy/fnamemodify_spec.lua index 570b523d92..0e6701c8dd 100644 --- a/test/functional/legacy/fnamemodify_spec.lua +++ b/test/functional/legacy/fnamemodify_spec.lua @@ -1,8 +1,8 @@ -- Test filename modifiers. -local helpers = require('test.functional.helpers')(after_each) -local clear, source = helpers.clear, helpers.source -local call, eq, nvim = helpers.call, helpers.eq, helpers.api +local t = require('test.functional.testutil')(after_each) +local clear, source = t.clear, t.source +local call, eq, nvim = t.call, t.eq, t.api local function expected_empty() eq({}, nvim.nvim_get_vvar('errors')) diff --git a/test/functional/legacy/fold_spec.lua b/test/functional/legacy/fold_spec.lua index 0a65948fc7..2ec6f2ee8d 100644 --- a/test/functional/legacy/fold_spec.lua +++ b/test/functional/legacy/fold_spec.lua @@ -1,17 +1,16 @@ -- Tests for folding. local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local feed, insert, feed_command, expect_any = - helpers.feed, helpers.insert, helpers.feed_command, helpers.expect_any -local command = helpers.command -local exec = helpers.exec +local t = require('test.functional.testutil')(after_each) +local feed, insert, feed_command, expect_any = t.feed, t.insert, t.feed_command, t.expect_any +local command = t.command +local exec = t.exec describe('folding', function() local screen before_each(function() - helpers.clear() + t.clear() screen = Screen.new(45, 8) screen:attach() @@ -61,7 +60,7 @@ describe('folding', function() feed('kYpj') feed_command('call append("$", foldlevel("."))') - helpers.poke_eventloop() + t.poke_eventloop() screen:expect([[ dd {{{ | ee {{{ }}} | @@ -87,7 +86,7 @@ describe('folding', function() feed_command('call append("$", foldlevel(2))') feed('zR') - helpers.poke_eventloop() + t.poke_eventloop() screen:expect([[ aa | bb | diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua index 36128bb0a2..d77691d0ac 100644 --- a/test/functional/legacy/function_sort_spec.lua +++ b/test/functional/legacy/function_sort_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) - -local eq = helpers.eq -local neq = helpers.neq -local eval = helpers.eval -local clear = helpers.clear -local source = helpers.source -local exc_exec = helpers.exc_exec +local t = require('test.functional.testutil')(after_each) + +local eq = t.eq +local neq = t.neq +local eval = t.eval +local clear = t.clear +local source = t.source +local exc_exec = t.exc_exec describe('sort', function() before_each(clear) diff --git a/test/functional/legacy/getcwd_spec.lua b/test/functional/legacy/getcwd_spec.lua index eae13da528..134d664236 100644 --- a/test/functional/legacy/getcwd_spec.lua +++ b/test/functional/legacy/getcwd_spec.lua @@ -1,14 +1,14 @@ -- Tests for getcwd(), haslocaldir(), and :lcd -local helpers = require('test.functional.helpers')(after_each) -local eq, eval, source = helpers.eq, helpers.eval, helpers.source -local call, clear, command = helpers.call, helpers.clear, helpers.command +local t = require('test.functional.testutil')(after_each) +local eq, eval, source = t.eq, t.eval, t.source +local call, clear, command = t.call, t.clear, t.command describe('getcwd', function() before_each(clear) after_each(function() - helpers.rmdir('Xtopdir') + t.rmdir('Xtopdir') end) it('is working', function() diff --git a/test/functional/legacy/gf_spec.lua b/test/functional/legacy/gf_spec.lua index b51f671bee..e9630f2180 100644 --- a/test/functional/legacy/gf_spec.lua +++ b/test/functional/legacy/gf_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local pcall_err = t.pcall_err describe('gf', function() before_each(clear) diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua index de304f3e4b..8a16eefa6c 100644 --- a/test/functional/legacy/glob2regpat_spec.lua +++ b/test/functional/legacy/glob2regpat_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq, eval = helpers.eq, helpers.eval +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq, eval = t.eq, t.eval describe('glob2regpat()', function() before_each(clear) diff --git a/test/functional/legacy/global_spec.lua b/test/functional/legacy/global_spec.lua index 60894afd39..37034241ec 100644 --- a/test/functional/legacy/global_spec.lua +++ b/test/functional/legacy/global_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed -local poke_eventloop = helpers.poke_eventloop +local clear = t.clear +local exec = t.exec +local feed = t.feed +local poke_eventloop = t.poke_eventloop before_each(clear) diff --git a/test/functional/legacy/highlight_spec.lua b/test/functional/legacy/highlight_spec.lua index 12913078b6..90d091c0f7 100644 --- a/test/functional/legacy/highlight_spec.lua +++ b/test/functional/legacy/highlight_spec.lua @@ -1,12 +1,12 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local clear, feed = helpers.clear, helpers.feed -local expect = helpers.expect -local eq = helpers.eq -local poke_eventloop = helpers.poke_eventloop -local exc_exec = helpers.exc_exec -local feed_command = helpers.feed_command -local exec = helpers.exec +local t = require('test.functional.testutil')(after_each) +local clear, feed = t.clear, t.feed +local expect = t.expect +local eq = t.eq +local poke_eventloop = t.poke_eventloop +local exc_exec = t.exc_exec +local feed_command = t.feed_command +local exec = t.exec before_each(clear) diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua index a81044114c..8368b5f2de 100644 --- a/test/functional/legacy/increment_spec.lua +++ b/test/functional/legacy/increment_spec.lua @@ -1,9 +1,9 @@ -- Tests for using Ctrl-A/Ctrl-X on visual selections -local helpers = require('test.functional.helpers')(after_each) -local source, command = helpers.source, helpers.command -local call, clear = helpers.call, helpers.clear -local eq, nvim = helpers.eq, helpers.api +local t = require('test.functional.testutil')(after_each) +local source, command = t.source, t.command +local call, clear = t.call, t.clear +local eq, nvim = t.eq, t.api describe('Ctrl-A/Ctrl-X on visual selections', function() before_each(function() diff --git a/test/functional/legacy/insertcount_spec.lua b/test/functional/legacy/insertcount_spec.lua index e53c9dc6ce..7669c97be2 100644 --- a/test/functional/legacy/insertcount_spec.lua +++ b/test/functional/legacy/insertcount_spec.lua @@ -1,8 +1,8 @@ -- Tests for repeating insert and replace. -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect = helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect = t.feed_command, t.expect describe('insertcount', function() setup(clear) diff --git a/test/functional/legacy/join_spec.lua b/test/functional/legacy/join_spec.lua index d683d25eb0..4e9e3a542c 100644 --- a/test/functional/legacy/join_spec.lua +++ b/test/functional/legacy/join_spec.lua @@ -1,8 +1,8 @@ -- Test for joining lines -local helpers = require('test.functional.helpers')(after_each) -local clear, eq = helpers.clear, helpers.eq -local eval, command = helpers.eval, helpers.command +local t = require('test.functional.testutil')(after_each) +local clear, eq = t.clear, t.eq +local eval, command = t.eval, t.command describe('joining lines', function() before_each(clear) diff --git a/test/functional/legacy/lispwords_spec.lua b/test/functional/legacy/lispwords_spec.lua index efac8775d3..6af7747049 100644 --- a/test/functional/legacy/lispwords_spec.lua +++ b/test/functional/legacy/lispwords_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local command = helpers.command -local source = helpers.source +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local eval = t.eval +local command = t.command +local source = t.source describe('lispwords', function() before_each(clear) diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua index 822dffaa21..cdbdaf288f 100644 --- a/test/functional/legacy/listchars_spec.lua +++ b/test/functional/legacy/listchars_spec.lua @@ -1,9 +1,9 @@ -- Tests for 'listchars' display with 'list' and :list. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed, insert, exec = helpers.feed, helpers.insert, helpers.exec -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local feed, insert, exec = t.feed, t.insert, t.exec +local clear, feed_command, expect = t.clear, t.feed_command, t.expect -- luacheck: ignore 621 (Indentation) describe("'listchars'", function() diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua index 2d8c010398..eeeab310c4 100644 --- a/test/functional/legacy/listlbr_spec.lua +++ b/test/functional/legacy/listlbr_spec.lua @@ -1,9 +1,9 @@ -- Test for linebreak and list option (non-utf8) -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local feed, insert, source = t.feed, t.insert, t.source +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('listlbr', function() before_each(clear) diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua index 874bda07ac..89799ac0fc 100644 --- a/test/functional/legacy/listlbr_utf8_spec.lua +++ b/test/functional/legacy/listlbr_utf8_spec.lua @@ -1,11 +1,11 @@ -- Test for linebreak and list option in utf-8 mode -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local source = helpers.source -local feed = helpers.feed -local exec = helpers.exec -local clear, expect = helpers.clear, helpers.expect +local source = t.source +local feed = t.feed +local exec = t.exec +local clear, expect = t.clear, t.expect describe('linebreak', function() before_each(clear) diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua index 9eddec40f7..ff3c553a8e 100644 --- a/test/functional/legacy/mapping_spec.lua +++ b/test/functional/legacy/mapping_spec.lua @@ -1,9 +1,9 @@ -- Test for mappings and abbreviations -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local expect, poke_eventloop = helpers.expect, helpers.poke_eventloop -local command, eq, eval, api = helpers.command, helpers.eq, helpers.eval, helpers.api +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local expect, poke_eventloop = t.expect, t.poke_eventloop +local command, eq, eval, api = t.command, t.eq, t.eval, t.api local sleep = vim.uv.sleep describe('mapping', function() diff --git a/test/functional/legacy/marks_spec.lua b/test/functional/legacy/marks_spec.lua index 470ea49652..ace8c35f63 100644 --- a/test/functional/legacy/marks_spec.lua +++ b/test/functional/legacy/marks_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local feed, insert, source = t.feed, t.insert, t.source +local clear, feed_command, expect = t.clear, t.feed_command, t.expect describe('marks', function() before_each(function() diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua index f29e171eb5..8d04fde602 100644 --- a/test/functional/legacy/match_spec.lua +++ b/test/functional/legacy/match_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local exec = t.exec +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua index adbf15d2e3..db5a24e2e0 100644 --- a/test/functional/legacy/matchparen_spec.lua +++ b/test/functional/legacy/matchparen_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local exec = t.exec +local feed = t.feed describe('matchparen', function() before_each(clear) diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua index 3a6eb2c31c..aba20387ef 100644 --- a/test/functional/legacy/memory_usage_spec.lua +++ b/test/functional/legacy/memory_usage_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eval = helpers.eval -local eq = helpers.eq -local feed_command = helpers.feed_command -local retry = helpers.retry -local ok = helpers.ok -local source = helpers.source -local poke_eventloop = helpers.poke_eventloop -local load_adjust = helpers.load_adjust -local write_file = helpers.write_file -local is_os = helpers.is_os -local is_ci = helpers.is_ci -local is_asan = helpers.is_asan +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eval = t.eval +local eq = t.eq +local feed_command = t.feed_command +local retry = t.retry +local ok = t.ok +local source = t.source +local poke_eventloop = t.poke_eventloop +local load_adjust = t.load_adjust +local write_file = t.write_file +local is_os = t.is_os +local is_ci = t.is_ci +local is_asan = t.is_asan clear() if is_asan() then diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 8a21c8add7..1a929f1397 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api -local nvim_dir = helpers.nvim_dir -local assert_alive = helpers.assert_alive +local clear = t.clear +local command = t.command +local exec = t.exec +local feed = t.feed +local api = t.api +local nvim_dir = t.nvim_dir +local assert_alive = t.assert_alive before_each(clear) diff --git a/test/functional/legacy/mksession_spec.lua b/test/functional/legacy/mksession_spec.lua index 689d918cd9..edad8f58f2 100644 --- a/test/functional/legacy/mksession_spec.lua +++ b/test/functional/legacy/mksession_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local fn = helpers.fn -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local fn = t.fn +local eq = t.eq describe('mksession', function() before_each(clear) diff --git a/test/functional/legacy/move_spec.lua b/test/functional/legacy/move_spec.lua index 42951e4360..2368b9ae83 100644 --- a/test/functional/legacy/move_spec.lua +++ b/test/functional/legacy/move_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local feed = helpers.feed -local fn = helpers.fn +local clear = t.clear +local feed = t.feed +local fn = t.fn before_each(clear) diff --git a/test/functional/legacy/nested_function_spec.lua b/test/functional/legacy/nested_function_spec.lua index 7a2ba1ecf2..3631b76a3d 100644 --- a/test/functional/legacy/nested_function_spec.lua +++ b/test/functional/legacy/nested_function_spec.lua @@ -1,8 +1,8 @@ -- Tests for nested function. -local helpers = require('test.functional.helpers')(after_each) -local clear, insert = helpers.clear, helpers.insert -local command, expect, source = helpers.command, helpers.expect, helpers.source +local t = require('test.functional.testutil')(after_each) +local clear, insert = t.clear, t.insert +local command, expect, source = t.command, t.expect, t.source describe('test_nested_function', function() setup(clear) diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua index 3dac1da14a..113f7c668a 100644 --- a/test/functional/legacy/normal_spec.lua +++ b/test/functional/legacy/normal_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api -local eq = helpers.eq -local fn = helpers.fn +local clear = t.clear +local exec = t.exec +local feed = t.feed +local api = t.api +local eq = t.eq +local fn = t.fn describe('normal', function() local screen diff --git a/test/functional/legacy/number_spec.lua b/test/functional/legacy/number_spec.lua index 4c4ff5c1da..3d00169946 100644 --- a/test/functional/legacy/number_spec.lua +++ b/test/functional/legacy/number_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local command = t.command +local exec = t.exec +local feed = t.feed describe("'number' and 'relativenumber'", function() before_each(clear) diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua index 7440774cbd..c7d6457eb7 100644 --- a/test/functional/legacy/options_spec.lua +++ b/test/functional/legacy/options_spec.lua @@ -1,9 +1,9 @@ -- See also: test/old/testdir/test_options.vim -local helpers = require('test.functional.helpers')(after_each) -local command, clear = helpers.command, helpers.clear -local source, expect = helpers.source, helpers.expect -local exc_exec = helpers.exc_exec -local matches = helpers.matches +local t = require('test.functional.testutil')(after_each) +local command, clear = t.command, t.clear +local source, expect = t.source, t.expect +local exc_exec = t.exc_exec +local matches = t.matches local Screen = require('test.functional.ui.screen') describe('options', function() diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua index 5f553aca25..782992d052 100644 --- a/test/functional/legacy/prompt_buffer_spec.lua +++ b/test/functional/legacy/prompt_buffer_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed = helpers.feed -local source = helpers.source -local clear = helpers.clear -local command = helpers.command -local expect = helpers.expect -local poke_eventloop = helpers.poke_eventloop -local api = helpers.api -local eq = helpers.eq -local neq = helpers.neq +local feed = t.feed +local source = t.source +local clear = t.clear +local command = t.command +local expect = t.expect +local poke_eventloop = t.poke_eventloop +local api = t.api +local eq = t.eq +local neq = t.neq describe('prompt buffer', function() local screen diff --git a/test/functional/legacy/put_spec.lua b/test/functional/legacy/put_spec.lua index 26f1501a4b..e0c261b6d9 100644 --- a/test/functional/legacy/put_spec.lua +++ b/test/functional/legacy/put_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local api = helpers.api -local source = helpers.source -local eq = helpers.eq +local clear = t.clear +local exec_lua = t.exec_lua +local api = t.api +local source = t.source +local eq = t.eq local function sizeoflong() if not exec_lua('return pcall(require, "ffi")') then diff --git a/test/functional/legacy/qf_title_spec.lua b/test/functional/legacy/qf_title_spec.lua index 9f97eb27b2..7359ad1f8a 100644 --- a/test/functional/legacy/qf_title_spec.lua +++ b/test/functional/legacy/qf_title_spec.lua @@ -1,8 +1,8 @@ -- Tests for quickfix window's title -local helpers = require('test.functional.helpers')(after_each) -local insert, source = helpers.insert, helpers.source -local clear, expect = helpers.clear, helpers.expect +local t = require('test.functional.testutil')(after_each) +local insert, source = t.insert, t.source +local clear, expect = t.clear, t.expect describe('qf_title', function() setup(clear) diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index c00993f5f7..2720b9f337 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed -local assert_alive = helpers.assert_alive +local clear = t.clear +local exec = t.exec +local feed = t.feed +local assert_alive = t.assert_alive before_each(clear) diff --git a/test/functional/legacy/search_mbyte_spec.lua b/test/functional/legacy/search_mbyte_spec.lua index ef7e41aa30..c8eef8e330 100644 --- a/test/functional/legacy/search_mbyte_spec.lua +++ b/test/functional/legacy/search_mbyte_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local poke_eventloop = helpers.poke_eventloop -local clear = helpers.clear -local insert = helpers.insert -local expect = helpers.expect -local command = helpers.command +local poke_eventloop = t.poke_eventloop +local clear = t.clear +local insert = t.insert +local expect = t.expect +local command = t.command describe('search_mbyte', function() before_each(clear) diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua index 53f0b10855..7b4cd90d9d 100644 --- a/test/functional/legacy/search_spec.lua +++ b/test/functional/legacy/search_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local fn = helpers.fn -local poke_eventloop = helpers.poke_eventloop -local exec = helpers.exec +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed +local fn = t.fn +local poke_eventloop = t.poke_eventloop +local exec = t.exec describe('search cmdline', function() local screen diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua index 378060d316..ee49cd1bcb 100644 --- a/test/functional/legacy/search_stat_spec.lua +++ b/test/functional/legacy/search_stat_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, exec, command = helpers.clear, helpers.feed, helpers.exec, helpers.command +local clear, feed, exec, command = t.clear, t.feed, t.exec, t.command describe('search stat', function() local screen diff --git a/test/functional/legacy/signs_spec.lua b/test/functional/legacy/signs_spec.lua index 0e65edbcf8..e240e1c87a 100644 --- a/test/functional/legacy/signs_spec.lua +++ b/test/functional/legacy/signs_spec.lua @@ -1,7 +1,7 @@ -- Tests for signs -local helpers = require('test.functional.helpers')(after_each) -local clear, command, expect = helpers.clear, helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, command, expect = t.clear, t.command, t.expect describe('signs', function() setup(clear) diff --git a/test/functional/legacy/source_spec.lua b/test/functional/legacy/source_spec.lua index 050cfbea19..2b9cf0b124 100644 --- a/test/functional/legacy/source_spec.lua +++ b/test/functional/legacy/source_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local feed = helpers.feed -local write_file = helpers.write_file +local clear = t.clear +local feed = t.feed +local write_file = t.write_file before_each(clear) diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua index 77f906c89a..6c508aa7f8 100644 --- a/test/functional/legacy/statusline_spec.lua +++ b/test/functional/legacy/statusline_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local exec = t.exec +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/substitute_spec.lua b/test/functional/legacy/substitute_spec.lua index 94a0bbd39e..6a2750d46d 100644 --- a/test/functional/legacy/substitute_spec.lua +++ b/test/functional/legacy/substitute_spec.lua @@ -2,12 +2,12 @@ -- Test for submatch() on substitute(). -- Test for *:s%* on :substitute. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed, insert = helpers.feed, helpers.insert -local exec = helpers.exec -local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect -local eq, eval = helpers.eq, helpers.eval +local feed, insert = t.feed, t.insert +local exec = t.exec +local clear, feed_command, expect = t.clear, t.feed_command, t.expect +local eq, eval = t.eq, t.eval describe('substitute()', function() before_each(clear) diff --git a/test/functional/legacy/syn_attr_spec.lua b/test/functional/legacy/syn_attr_spec.lua index ec47bdf9af..153e20fc94 100644 --- a/test/functional/legacy/syn_attr_spec.lua +++ b/test/functional/legacy/syn_attr_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval -- oldtest: Test_missing_attr() describe('synIDattr()', function() diff --git a/test/functional/legacy/tabline_spec.lua b/test/functional/legacy/tabline_spec.lua index 54ebb51430..d92f46b8eb 100644 --- a/test/functional/legacy/tabline_spec.lua +++ b/test/functional/legacy/tabline_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local exec = t.exec +local feed = t.feed before_each(clear) diff --git a/test/functional/legacy/tagcase_spec.lua b/test/functional/legacy/tagcase_spec.lua index f84fc673cf..ae80282ed6 100644 --- a/test/functional/legacy/tagcase_spec.lua +++ b/test/functional/legacy/tagcase_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local exc_exec = helpers.exc_exec -local expect = helpers.expect -local insert = helpers.insert -local source = helpers.source -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local eval = t.eval +local exc_exec = t.exc_exec +local expect = t.expect +local insert = t.insert +local source = t.source +local write_file = t.write_file describe("'tagcase' option", function() setup(function() diff --git a/test/functional/legacy/textobjects_spec.lua b/test/functional/legacy/textobjects_spec.lua index 96f655cc41..ed22c26c48 100644 --- a/test/functional/legacy/textobjects_spec.lua +++ b/test/functional/legacy/textobjects_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local call = helpers.call -local clear = helpers.clear -local command = helpers.command -local expect = helpers.expect -local source = helpers.source +local t = require('test.functional.testutil')(after_each) +local call = t.call +local clear = t.clear +local command = t.command +local expect = t.expect +local source = t.source describe('Text object', function() before_each(function() diff --git a/test/functional/legacy/undolevels_spec.lua b/test/functional/legacy/undolevels_spec.lua index e8badc6864..f6beb28dea 100644 --- a/test/functional/legacy/undolevels_spec.lua +++ b/test/functional/legacy/undolevels_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local source, clear = helpers.source, helpers.clear -local eq, nvim = helpers.eq, helpers.api +local t = require('test.functional.testutil')(after_each) +local source, clear = t.source, t.clear +local eq, nvim = t.eq, t.api describe('undolevel', function() setup(clear) diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua index 67a4bec4c5..155352a0c2 100644 --- a/test/functional/legacy/utf8_spec.lua +++ b/test/functional/legacy/utf8_spec.lua @@ -1,11 +1,11 @@ -- Tests for Unicode manipulations -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, expect = helpers.command, helpers.expect -local eq, eval = helpers.eq, helpers.eval -local source = helpers.source -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear, feed, insert = t.clear, t.feed, t.insert +local command, expect = t.command, t.expect +local eq, eval = t.eq, t.eval +local source = t.source +local poke_eventloop = t.poke_eventloop describe('utf8', function() before_each(clear) diff --git a/test/functional/legacy/vimscript_spec.lua b/test/functional/legacy/vimscript_spec.lua index 8b0a920a3e..7083745b54 100644 --- a/test/functional/legacy/vimscript_spec.lua +++ b/test/functional/legacy/vimscript_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed -local api = helpers.api +local clear = t.clear +local exec = t.exec +local feed = t.feed +local api = t.api before_each(clear) diff --git a/test/functional/legacy/visual_spec.lua b/test/functional/legacy/visual_spec.lua index 001a44a15c..0a09ccff73 100644 --- a/test/functional/legacy/visual_spec.lua +++ b/test/functional/legacy/visual_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local feed = helpers.feed -local exec = helpers.exec +local clear = t.clear +local feed = t.feed +local exec = t.exec before_each(clear) diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua index 8482bf34f7..0ea654dd0d 100644 --- a/test/functional/legacy/window_cmd_spec.lua +++ b/test/functional/legacy/window_cmd_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local command = helpers.command -local feed = helpers.feed +local clear = t.clear +local exec = t.exec +local exec_lua = t.exec_lua +local command = t.command +local feed = t.feed -- oldtest: Test_window_cmd_ls0_split_scrolling() it('scrolling with laststatus=0 and :botright split', function() diff --git a/test/functional/legacy/wordcount_spec.lua b/test/functional/legacy/wordcount_spec.lua index 82021dd98d..0b5cba52f0 100644 --- a/test/functional/legacy/wordcount_spec.lua +++ b/test/functional/legacy/wordcount_spec.lua @@ -1,10 +1,10 @@ -- Test for wordcount() function -local helpers = require('test.functional.helpers')(after_each) -local feed, insert, source = helpers.feed, helpers.insert, helpers.source -local clear, command = helpers.clear, helpers.command -local eq, eval = helpers.eq, helpers.eval -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local feed, insert, source = t.feed, t.insert, t.source +local clear, command = t.clear, t.command +local eq, eval = t.eq, t.eval +local poke_eventloop = t.poke_eventloop describe('wordcount', function() before_each(clear) diff --git a/test/functional/legacy/writefile_spec.lua b/test/functional/legacy/writefile_spec.lua index 4d54e07d6a..63ea4e3f11 100644 --- a/test/functional/legacy/writefile_spec.lua +++ b/test/functional/legacy/writefile_spec.lua @@ -1,7 +1,7 @@ -- Tests for writefile() -local helpers = require('test.functional.helpers')(after_each) -local clear, command, expect = helpers.clear, helpers.command, helpers.expect +local t = require('test.functional.testutil')(after_each) +local clear, command, expect = t.clear, t.command, t.expect describe('writefile', function() setup(clear) diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua index acd56a0ddb..0aa63327ad 100644 --- a/test/functional/lua/api_spec.lua +++ b/test/functional/lua/api_spec.lua @@ -1,15 +1,15 @@ -- Test suite for testing interactions with API bindings -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local exc_exec = helpers.exc_exec -local remove_trace = helpers.remove_trace -local fn = helpers.fn -local clear = helpers.clear -local eval = helpers.eval +local exc_exec = t.exc_exec +local remove_trace = t.remove_trace +local fn = t.fn +local clear = t.clear +local eval = t.eval local NIL = vim.NIL -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local pcall_err = helpers.pcall_err +local eq = t.eq +local exec_lua = t.exec_lua +local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/lua/base64_spec.lua b/test/functional/lua/base64_spec.lua index 21fd536a98..9410a6fd6f 100644 --- a/test/functional/lua/base64_spec.lua +++ b/test/functional/lua/base64_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local pcall_err = helpers.pcall_err -local matches = helpers.matches +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local pcall_err = t.pcall_err +local matches = t.matches describe('vim.base64', function() before_each(clear) diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 01dc8c2f02..490177b96b 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -1,18 +1,18 @@ -- Test suite for testing interactions with API bindings -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local command = helpers.command -local api = helpers.api -local fn = helpers.fn -local clear = helpers.clear -local eq = helpers.eq -local fail = helpers.fail -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local expect_events = helpers.expect_events -local write_file = helpers.write_file -local dedent = helpers.dedent +local command = t.command +local api = t.api +local fn = t.fn +local clear = t.clear +local eq = t.eq +local fail = t.fail +local exec_lua = t.exec_lua +local feed = t.feed +local expect_events = t.expect_events +local write_file = t.write_file +local dedent = t.dedent local origlines = { 'original line 1', @@ -292,11 +292,11 @@ describe('lua buffer event callbacks: on_lines', function() exec_lua(code) command('q!') - helpers.assert_alive() + t.assert_alive() exec_lua(code) command('bd!') - helpers.assert_alive() + t.assert_alive() end) it('#12718 lnume', function() @@ -965,7 +965,7 @@ describe('lua: nvim_buf_attach on_bytes', function() command('e! Xtest-undofile') command('set undodir=. | set undofile') - local ns = helpers.request('nvim_create_namespace', 'ns1') + local ns = t.request('nvim_create_namespace', 'ns1') api.nvim_buf_set_extmark(0, ns, 0, 0, {}) eq({ '12345', 'hello world' }, api.nvim_buf_get_lines(0, 0, -1, true)) diff --git a/test/functional/lua/command_line_completion_spec.lua b/test/functional/lua/command_line_completion_spec.lua index b88a38082f..41e807f086 100644 --- a/test/functional/lua/command_line_completion_spec.lua +++ b/test/functional/lua/command_line_completion_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local clear = t.clear +local eq = t.eq +local exec_lua = t.exec_lua local get_completions = function(input, env) return exec_lua('return {vim._expand_pat(...)}', input, env) diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua index b8d0638ce5..04188281bc 100644 --- a/test/functional/lua/commands_spec.lua +++ b/test/functional/lua/commands_spec.lua @@ -1,24 +1,24 @@ -- Test suite for checking :lua* commands -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq +local eq = t.eq local NIL = vim.NIL -local eval = helpers.eval -local feed = helpers.feed -local clear = helpers.clear -local matches = helpers.matches -local api = helpers.api -local exec_lua = helpers.exec_lua -local exec_capture = helpers.exec_capture -local fn = helpers.fn -local source = helpers.source -local dedent = helpers.dedent -local command = helpers.command -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err -local write_file = helpers.write_file -local remove_trace = helpers.remove_trace +local eval = t.eval +local feed = t.feed +local clear = t.clear +local matches = t.matches +local api = t.api +local exec_lua = t.exec_lua +local exec_capture = t.exec_capture +local fn = t.fn +local source = t.source +local dedent = t.dedent +local command = t.command +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err +local write_file = t.write_file +local remove_trace = t.remove_trace before_each(clear) diff --git a/test/functional/lua/comment_spec.lua b/test/functional/lua/comment_spec.lua index 72935c47d5..3b230780ad 100644 --- a/test/functional/lua/comment_spec.lua +++ b/test/functional/lua/comment_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) - -local api = helpers.api -local clear = helpers.clear -local eq = helpers.eq -local exec_capture = helpers.exec_capture -local exec_lua = helpers.exec_lua -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) + +local api = t.api +local clear = t.clear +local eq = t.eq +local exec_capture = t.exec_capture +local exec_lua = t.exec_lua +local feed = t.feed -- Reference text -- aa diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua index f648c0b215..152258dd8c 100644 --- a/test/functional/lua/diagnostic_spec.lua +++ b/test/functional/lua/diagnostic_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local NIL = vim.NIL -local command = helpers.command -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local matches = helpers.matches -local api = helpers.api -local pcall_err = helpers.pcall_err -local fn = helpers.fn +local command = t.command +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local matches = t.matches +local api = t.api +local pcall_err = t.pcall_err +local fn = t.fn describe('vim.diagnostic', function() before_each(function() @@ -1826,20 +1826,12 @@ describe('vim.diagnostic', function() it('respects legacy signs placed with :sign define or sign_define #26618', function() -- Legacy signs for diagnostics were deprecated in 0.10 and will be removed in 0.12 - eq(0, helpers.fn.has('nvim-0.12')) + eq(0, t.fn.has('nvim-0.12')) - helpers.command( - 'sign define DiagnosticSignError text= texthl= linehl=ErrorMsg numhl=ErrorMsg' - ) - helpers.command( - 'sign define DiagnosticSignWarn text= texthl= linehl=WarningMsg numhl=WarningMsg' - ) - helpers.command( - 'sign define DiagnosticSignInfo text= texthl= linehl=Underlined numhl=Underlined' - ) - helpers.command( - 'sign define DiagnosticSignHint text= texthl= linehl=Underlined numhl=Underlined' - ) + t.command('sign define DiagnosticSignError text= texthl= linehl=ErrorMsg numhl=ErrorMsg') + t.command('sign define DiagnosticSignWarn text= texthl= linehl=WarningMsg numhl=WarningMsg') + t.command('sign define DiagnosticSignInfo text= texthl= linehl=Underlined numhl=Underlined') + t.command('sign define DiagnosticSignHint text= texthl= linehl=Underlined numhl=Underlined') local result = exec_lua [[ vim.diagnostic.config({ diff --git a/test/functional/lua/ffi_spec.lua b/test/functional/lua/ffi_spec.lua index 4229e4af9b..2cde9f4f2a 100644 --- a/test/functional/lua/ffi_spec.lua +++ b/test/functional/lua/ffi_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local clear = helpers.clear +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local exec_lua = t.exec_lua +local clear = t.clear before_each(clear) diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua index 3ef650a1d2..677d039b81 100644 --- a/test/functional/lua/filetype_spec.lua +++ b/test/functional/lua/filetype_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local api = helpers.api -local clear = helpers.clear -local pathroot = helpers.pathroot -local command = helpers.command -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) +local exec_lua = t.exec_lua +local eq = t.eq +local api = t.api +local clear = t.clear +local pathroot = t.pathroot +local command = t.command +local mkdir = t.mkdir +local rmdir = t.rmdir +local write_file = t.write_file local uv = vim.uv local root = pathroot() diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua index 6e7811908b..a0df71b20a 100644 --- a/test/functional/lua/fs_spec.lua +++ b/test/functional/lua/fs_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local mkdir_p = helpers.mkdir_p -local rmdir = helpers.rmdir -local nvim_dir = helpers.nvim_dir -local test_build_dir = helpers.paths.test_build_dir -local test_source_path = helpers.paths.test_source_path -local nvim_prog = helpers.nvim_prog -local is_os = helpers.is_os -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local mkdir_p = t.mkdir_p +local rmdir = t.rmdir +local nvim_dir = t.nvim_dir +local test_build_dir = t.paths.test_build_dir +local test_source_path = t.paths.test_source_path +local nvim_prog = t.nvim_prog +local is_os = t.is_os +local mkdir = t.mkdir local nvim_prog_basename = is_os('win') and 'nvim.exe' or 'nvim' diff --git a/test/functional/lua/glob_spec.lua b/test/functional/lua/glob_spec.lua index 1eac037575..dbe1079092 100644 --- a/test/functional/lua/glob_spec.lua +++ b/test/functional/lua/glob_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local exec_lua = t.exec_lua describe('glob', function() - before_each(helpers.clear) - after_each(helpers.clear) + before_each(t.clear) + after_each(t.clear) local match = function(...) return exec_lua( diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/highlight_spec.lua index 197f3139f3..dc80a1672a 100644 --- a/test/functional/lua/highlight_spec.lua +++ b/test/functional/lua/highlight_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local neq = helpers.neq -local eval = helpers.eval -local command = helpers.command -local clear = helpers.clear -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local exec_lua = t.exec_lua +local eq = t.eq +local neq = t.neq +local eval = t.eval +local command = t.command +local clear = t.clear +local api = t.api describe('vim.highlight.on_yank', function() before_each(function() @@ -19,7 +19,7 @@ describe('vim.highlight.on_yank', function() vim.cmd('bwipeout!') ]]) vim.uv.sleep(10) - helpers.feed('<cr>') -- avoid hang if error message exists + t.feed('<cr>') -- avoid hang if error message exists eq('', eval('v:errmsg')) end) diff --git a/test/functional/lua/inspector_spec.lua b/test/functional/lua/inspector_spec.lua index ad8b5a45a8..efc710d0d7 100644 --- a/test/functional/lua/inspector_spec.lua +++ b/test/functional/lua/inspector_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local eval = helpers.eval -local clear = helpers.clear +local t = require('test.functional.testutil')(after_each) +local exec_lua = t.exec_lua +local eq = t.eq +local eval = t.eval +local clear = t.clear describe('vim.inspect_pos', function() before_each(function() diff --git a/test/functional/lua/iter_spec.lua b/test/functional/lua/iter_spec.lua index 6d8a37f022..237710242d 100644 --- a/test/functional/lua/iter_spec.lua +++ b/test/functional/lua/iter_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local matches = helpers.matches -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local matches = t.matches +local pcall_err = t.pcall_err describe('vim.iter', function() it('new() on iterable class instance', function() @@ -18,12 +18,12 @@ describe('vim.iter', function() return v % 2 ~= 0 end - local t = { 1, 2, 3, 4, 5 } - eq({ 1, 3, 5 }, vim.iter(t):filter(odd):totable()) + local q = { 1, 2, 3, 4, 5 } + eq({ 1, 3, 5 }, vim.iter(q):filter(odd):totable()) eq( { 2, 4 }, vim - .iter(t) + .iter(q) :filter(function(v) return not odd(v) end) @@ -32,7 +32,7 @@ describe('vim.iter', function() eq( {}, vim - .iter(t) + .iter(q) :filter(function(v) return v > 5 end) @@ -40,7 +40,7 @@ describe('vim.iter', function() ) do - local it = vim.iter(ipairs(t)) + local it = vim.iter(ipairs(q)) it:filter(function(i, v) return i > 1 and v < 5 end) @@ -60,11 +60,11 @@ describe('vim.iter', function() end) it('map()', function() - local t = { 1, 2, 3, 4, 5 } + local q = { 1, 2, 3, 4, 5 } eq( { 2, 4, 6, 8, 10 }, vim - .iter(t) + .iter(q) :map(function(v) return 2 * v end) @@ -96,10 +96,10 @@ describe('vim.iter', function() end) it('for loops', function() - local t = { 1, 2, 3, 4, 5 } + local q = { 1, 2, 3, 4, 5 } local acc = 0 for v in - vim.iter(t):map(function(v) + vim.iter(q):map(function(v) return v * 3 end) do @@ -146,13 +146,13 @@ describe('vim.iter', function() it('skip()', function() do - local t = { 4, 3, 2, 1 } - eq(t, vim.iter(t):skip(0):totable()) - eq({ 3, 2, 1 }, vim.iter(t):skip(1):totable()) - eq({ 2, 1 }, vim.iter(t):skip(2):totable()) - eq({ 1 }, vim.iter(t):skip(#t - 1):totable()) - eq({}, vim.iter(t):skip(#t):totable()) - eq({}, vim.iter(t):skip(#t + 1):totable()) + local q = { 4, 3, 2, 1 } + eq(q, vim.iter(q):skip(0):totable()) + eq({ 3, 2, 1 }, vim.iter(q):skip(1):totable()) + eq({ 2, 1 }, vim.iter(q):skip(2):totable()) + eq({ 1 }, vim.iter(q):skip(#q - 1):totable()) + eq({}, vim.iter(q):skip(#q):totable()) + eq({}, vim.iter(q):skip(#q + 1):totable()) end do @@ -170,13 +170,13 @@ describe('vim.iter', function() it('skipback()', function() do - local t = { 4, 3, 2, 1 } - eq(t, vim.iter(t):skipback(0):totable()) - eq({ 4, 3, 2 }, vim.iter(t):skipback(1):totable()) - eq({ 4, 3 }, vim.iter(t):skipback(2):totable()) - eq({ 4 }, vim.iter(t):skipback(#t - 1):totable()) - eq({}, vim.iter(t):skipback(#t):totable()) - eq({}, vim.iter(t):skipback(#t + 1):totable()) + local q = { 4, 3, 2, 1 } + eq(q, vim.iter(q):skipback(0):totable()) + eq({ 4, 3, 2 }, vim.iter(q):skipback(1):totable()) + eq({ 4, 3 }, vim.iter(q):skipback(2):totable()) + eq({ 4 }, vim.iter(q):skipback(#q - 1):totable()) + eq({}, vim.iter(q):skipback(#q):totable()) + eq({}, vim.iter(q):skipback(#q + 1):totable()) end local it = vim.iter(vim.gsplit('a|b|c|d', '|')) @@ -184,14 +184,14 @@ describe('vim.iter', function() end) it('slice()', function() - local t = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } - eq({ 3, 4, 5, 6, 7 }, vim.iter(t):slice(3, 7):totable()) - eq({}, vim.iter(t):slice(6, 5):totable()) - eq({}, vim.iter(t):slice(0, 0):totable()) - eq({ 1 }, vim.iter(t):slice(1, 1):totable()) - eq({ 1, 2 }, vim.iter(t):slice(1, 2):totable()) - eq({ 10 }, vim.iter(t):slice(10, 10):totable()) - eq({ 8, 9, 10 }, vim.iter(t):slice(8, 11):totable()) + local q = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } + eq({ 3, 4, 5, 6, 7 }, vim.iter(q):slice(3, 7):totable()) + eq({}, vim.iter(q):slice(6, 5):totable()) + eq({}, vim.iter(q):slice(0, 0):totable()) + eq({ 1 }, vim.iter(q):slice(1, 1):totable()) + eq({ 1, 2 }, vim.iter(q):slice(1, 2):totable()) + eq({ 10 }, vim.iter(q):slice(10, 10):totable()) + eq({ 8, 9, 10 }, vim.iter(q):slice(8, 11):totable()) local it = vim.iter(vim.gsplit('a|b|c|d', '|')) matches('slice%(%) requires a list%-like table', pcall_err(it.slice, it, 1, 3)) @@ -199,13 +199,13 @@ describe('vim.iter', function() it('nth()', function() do - local t = { 4, 3, 2, 1 } - eq(nil, vim.iter(t):nth(0)) - eq(4, vim.iter(t):nth(1)) - eq(3, vim.iter(t):nth(2)) - eq(2, vim.iter(t):nth(3)) - eq(1, vim.iter(t):nth(4)) - eq(nil, vim.iter(t):nth(5)) + local q = { 4, 3, 2, 1 } + eq(nil, vim.iter(q):nth(0)) + eq(4, vim.iter(q):nth(1)) + eq(3, vim.iter(q):nth(2)) + eq(2, vim.iter(q):nth(3)) + eq(1, vim.iter(q):nth(4)) + eq(nil, vim.iter(q):nth(5)) end do @@ -223,13 +223,13 @@ describe('vim.iter', function() it('nthback()', function() do - local t = { 4, 3, 2, 1 } - eq(nil, vim.iter(t):nthback(0)) - eq(1, vim.iter(t):nthback(1)) - eq(2, vim.iter(t):nthback(2)) - eq(3, vim.iter(t):nthback(3)) - eq(4, vim.iter(t):nthback(4)) - eq(nil, vim.iter(t):nthback(5)) + local q = { 4, 3, 2, 1 } + eq(nil, vim.iter(q):nthback(0)) + eq(1, vim.iter(q):nthback(1)) + eq(2, vim.iter(q):nthback(2)) + eq(3, vim.iter(q):nthback(3)) + eq(4, vim.iter(q):nthback(4)) + eq(nil, vim.iter(q):nthback(5)) end local it = vim.iter(vim.gsplit('a|b|c|d', '|')) @@ -238,24 +238,24 @@ describe('vim.iter', function() it('take()', function() do - local t = { 4, 3, 2, 1 } - eq({}, vim.iter(t):take(0):totable()) - eq({ 4 }, vim.iter(t):take(1):totable()) - eq({ 4, 3 }, vim.iter(t):take(2):totable()) - eq({ 4, 3, 2 }, vim.iter(t):take(3):totable()) - eq({ 4, 3, 2, 1 }, vim.iter(t):take(4):totable()) - eq({ 4, 3, 2, 1 }, vim.iter(t):take(5):totable()) + local q = { 4, 3, 2, 1 } + eq({}, vim.iter(q):take(0):totable()) + eq({ 4 }, vim.iter(q):take(1):totable()) + eq({ 4, 3 }, vim.iter(q):take(2):totable()) + eq({ 4, 3, 2 }, vim.iter(q):take(3):totable()) + eq({ 4, 3, 2, 1 }, vim.iter(q):take(4):totable()) + eq({ 4, 3, 2, 1 }, vim.iter(q):take(5):totable()) end do - local t = { 4, 3, 2, 1 } - eq({ 1, 2, 3 }, vim.iter(t):rev():take(3):totable()) - eq({ 2, 3, 4 }, vim.iter(t):take(3):rev():totable()) + local q = { 4, 3, 2, 1 } + eq({ 1, 2, 3 }, vim.iter(q):rev():take(3):totable()) + eq({ 2, 3, 4 }, vim.iter(q):take(3):rev():totable()) end do - local t = { 4, 3, 2, 1 } - local it = vim.iter(t) + local q = { 4, 3, 2, 1 } + local it = vim.iter(q) eq({ 4, 3 }, it:take(2):totable()) -- tail is already set from the previous take() eq({ 4, 3 }, it:take(3):totable()) @@ -275,13 +275,13 @@ describe('vim.iter', function() end do - local t = { 4, 8, 9, 10 } - eq(true, vim.iter(t):any(odd)) + local q = { 4, 8, 9, 10 } + eq(true, vim.iter(q):any(odd)) end do - local t = { 4, 8, 10 } - eq(false, vim.iter(t):any(odd)) + local q = { 4, 8, 10 } + eq(false, vim.iter(q):any(odd)) end do @@ -306,13 +306,13 @@ describe('vim.iter', function() end do - local t = { 3, 5, 7, 9 } - eq(true, vim.iter(t):all(odd)) + local q = { 3, 5, 7, 9 } + eq(true, vim.iter(q):all(odd)) end do - local t = { 3, 5, 7, 10 } - eq(false, vim.iter(t):all(odd)) + local q = { 3, 5, 7, 10 } + eq(false, vim.iter(q):all(odd)) end do @@ -360,18 +360,18 @@ describe('vim.iter', function() end) it('find()', function() - local t = { 3, 6, 9, 12 } - eq(12, vim.iter(t):find(12)) - eq(nil, vim.iter(t):find(15)) + local q = { 3, 6, 9, 12 } + eq(12, vim.iter(q):find(12)) + eq(nil, vim.iter(q):find(15)) eq( 12, - vim.iter(t):find(function(v) + vim.iter(q):find(function(v) return v % 4 == 0 end) ) do - local it = vim.iter(t) + local it = vim.iter(q) local pred = function(v) return v % 3 == 0 end @@ -395,16 +395,16 @@ describe('vim.iter', function() end) it('rfind()', function() - local t = { 1, 2, 3, 2, 1 } + local q = { 1, 2, 3, 2, 1 } do - local it = vim.iter(t) + local it = vim.iter(q) eq(1, it:rfind(1)) eq(1, it:rfind(1)) eq(nil, it:rfind(1)) end do - local it = vim.iter(t):enumerate() + local it = vim.iter(q):enumerate() local pred = function(i) return i % 2 ~= 0 end @@ -452,16 +452,16 @@ describe('vim.iter', function() end) it('fold()', function() - local t = { 1, 2, 3, 4, 5 } + local q = { 1, 2, 3, 4, 5 } eq( 115, - vim.iter(t):fold(100, function(acc, v) + vim.iter(q):fold(100, function(acc, v) return acc + v end) ) eq( { 5, 4, 3, 2, 1 }, - vim.iter(t):fold({}, function(acc, v) + vim.iter(q):fold({}, function(acc, v) table.insert(acc, 1, v) return acc end) @@ -469,14 +469,14 @@ describe('vim.iter', function() end) it('flatten()', function() - local t = { { 1, { 2 } }, { { { { 3 } } }, { 4 } }, { 5 } } + local q = { { 1, { 2 } }, { { { { 3 } } }, { 4 } }, { 5 } } - eq(t, vim.iter(t):flatten(-1):totable()) - eq(t, vim.iter(t):flatten(0):totable()) - eq({ 1, { 2 }, { { { 3 } } }, { 4 }, 5 }, vim.iter(t):flatten():totable()) - eq({ 1, 2, { { 3 } }, 4, 5 }, vim.iter(t):flatten(2):totable()) - eq({ 1, 2, { 3 }, 4, 5 }, vim.iter(t):flatten(3):totable()) - eq({ 1, 2, 3, 4, 5 }, vim.iter(t):flatten(4):totable()) + eq(q, vim.iter(q):flatten(-1):totable()) + eq(q, vim.iter(q):flatten(0):totable()) + eq({ 1, { 2 }, { { { 3 } } }, { 4 }, 5 }, vim.iter(q):flatten():totable()) + eq({ 1, 2, { { 3 } }, 4, 5 }, vim.iter(q):flatten(2):totable()) + eq({ 1, 2, { 3 }, 4, 5 }, vim.iter(q):flatten(3):totable()) + eq({ 1, 2, 3, 4, 5 }, vim.iter(q):flatten(4):totable()) local m = { a = 1, b = { 2, 3 }, d = { 4 } } local it = vim.iter(m) @@ -507,11 +507,11 @@ describe('vim.iter', function() end end) - local t = it:fold({}, function(t, k, v) - t[k] = v - return t + local q = it:fold({}, function(q, k, v) + q[k] = v + return q end) - eq({ A = 2, C = 6 }, t) + eq({ A = 2, C = 6 }, q) end) it('handles table values mid-pipeline', function() diff --git a/test/functional/lua/json_spec.lua b/test/functional/lua/json_spec.lua index d348e2de3c..af545fdfdf 100644 --- a/test/functional/lua/json_spec.lua +++ b/test/functional/lua/json_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local pcall_err = t.pcall_err describe('vim.json.decode()', function() before_each(function() diff --git a/test/functional/lua/loader_spec.lua b/test/functional/lua/loader_spec.lua index 6f74385e45..89be7a4c09 100644 --- a/test/functional/lua/loader_spec.lua +++ b/test/functional/lua/loader_spec.lua @@ -1,10 +1,10 @@ -- Test suite for testing interactions with API bindings -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local exec_lua = helpers.exec_lua -local command = helpers.command -local clear = helpers.clear -local eq = helpers.eq +local exec_lua = t.exec_lua +local command = t.command +local clear = t.clear +local eq = t.eq describe('vim.loader', function() before_each(clear) @@ -35,7 +35,7 @@ describe('vim.loader', function() vim.loader.enable() ]] - local tmp = helpers.tmpname() + local tmp = t.tmpname() command('edit ' .. tmp) eq( @@ -73,15 +73,15 @@ describe('vim.loader', function() vim.loader.enable() ]] - local t = helpers.tmpname() - assert(os.remove(t)) - assert(helpers.mkdir(t)) - assert(helpers.mkdir(t .. '/%')) - local tmp1 = t .. '/%/x' - local tmp2 = t .. '/%%x' + local tmp = t.tmpname() + assert(os.remove(tmp)) + assert(t.mkdir(tmp)) + assert(t.mkdir(tmp .. '/%')) + local tmp1 = tmp .. '/%/x' + local tmp2 = tmp .. '/%%x' - helpers.write_file(tmp1, 'return 1', true) - helpers.write_file(tmp2, 'return 2', true) + t.write_file(tmp1, 'return 1', true) + t.write_file(tmp2, 'return 2', true) vim.uv.fs_utime(tmp1, 0, 0) vim.uv.fs_utime(tmp2, 0, 0) eq(1, exec_lua('return loadfile(...)()', tmp1)) diff --git a/test/functional/lua/loop_spec.lua b/test/functional/lua/loop_spec.lua index 71eaf29009..13ffb97fbb 100644 --- a/test/functional/lua/loop_spec.lua +++ b/test/functional/lua/loop_spec.lua @@ -1,16 +1,16 @@ -- Test suite for testing interactions with API bindings -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local fn = helpers.fn -local api = helpers.api -local clear = helpers.clear +local fn = t.fn +local api = t.api +local clear = t.clear local sleep = vim.uv.sleep -local feed = helpers.feed -local eq = helpers.eq -local eval = helpers.eval -local matches = helpers.matches -local exec_lua = helpers.exec_lua -local retry = helpers.retry +local feed = t.feed +local eq = t.eq +local eval = t.eval +local matches = t.matches +local exec_lua = t.exec_lua +local retry = t.retry before_each(clear) diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index b28cfa4dd2..67d5da28a1 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -1,19 +1,19 @@ -- Test suite for testing luaeval() function -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local pcall_err = helpers.pcall_err -local exc_exec = helpers.exc_exec -local remove_trace = helpers.remove_trace -local exec_lua = helpers.exec_lua -local command = helpers.command -local api = helpers.api -local fn = helpers.fn -local clear = helpers.clear -local eval = helpers.eval -local feed = helpers.feed +local pcall_err = t.pcall_err +local exc_exec = t.exc_exec +local remove_trace = t.remove_trace +local exec_lua = t.exec_lua +local command = t.command +local api = t.api +local fn = t.fn +local clear = t.clear +local eval = t.eval +local feed = t.feed local NIL = vim.NIL -local eq = helpers.eq +local eq = t.eq before_each(clear) @@ -38,8 +38,8 @@ describe('luaeval()', function() describe('second argument', function() it('is successfully received', function() - local t = {t=true, f=false, --[[n=NIL,]] d={l={'string', 42, 0.42}}} - eq(t, fn.luaeval("_A", t)) + local q = {t=true, f=false, --[[n=NIL,]] d={l={'string', 42, 0.42}}} + eq(q, fn.luaeval("_A", q)) -- Not tested: nil, funcrefs, returned object identity: behaviour will -- most likely change. end) diff --git a/test/functional/lua/mpack_spec.lua b/test/functional/lua/mpack_spec.lua index 0b6a6d60bd..28a316dd97 100644 --- a/test/functional/lua/mpack_spec.lua +++ b/test/functional/lua/mpack_spec.lua @@ -1,9 +1,9 @@ -- Test suite for testing interactions with API bindings -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local clear = t.clear +local eq = t.eq +local exec_lua = t.exec_lua describe('lua vim.mpack', function() before_each(clear) diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index 428b2e0921..9b69857cd4 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -1,19 +1,19 @@ -- Test for Vim overrides of lua built-ins -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq +local eq = t.eq local NIL = vim.NIL -local feed = helpers.feed -local clear = helpers.clear -local fn = helpers.fn -local api = helpers.api -local command = helpers.command -local write_file = helpers.write_file -local exec_capture = helpers.exec_capture -local exec_lua = helpers.exec_lua -local pcall_err = helpers.pcall_err -local is_os = helpers.is_os +local feed = t.feed +local clear = t.clear +local fn = t.fn +local api = t.api +local command = t.command +local write_file = t.write_file +local exec_capture = t.exec_capture +local exec_lua = t.exec_lua +local pcall_err = t.pcall_err +local is_os = t.is_os local fname = 'Xtest-functional-lua-overrides-luafile' diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/lua/runtime_spec.lua index 6f36ccfb9e..6acf6ce305 100644 --- a/test/functional/lua/runtime_spec.lua +++ b/test/functional/lua/runtime_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local exec = helpers.exec -local fn = helpers.fn -local mkdir_p = helpers.mkdir_p -local rmdir = helpers.rmdir -local write_file = helpers.write_file +local clear = t.clear +local eq = t.eq +local eval = t.eval +local exec = t.exec +local fn = t.fn +local mkdir_p = t.mkdir_p +local rmdir = t.rmdir +local write_file = t.write_file describe('runtime:', function() local plug_dir = 'Test_Plugin' - local sep = helpers.get_pathsep() + local sep = t.get_pathsep() local init = 'dummy_init.lua' setup(function() diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua index 20e73b9693..0a5c67ef38 100644 --- a/test/functional/lua/secure_spec.lua +++ b/test/functional/lua/secure_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local clear = helpers.clear -local command = helpers.command -local pathsep = helpers.get_pathsep() -local is_os = helpers.is_os -local api = helpers.api -local exec_lua = helpers.exec_lua -local feed_command = helpers.feed_command -local feed = helpers.feed -local fn = helpers.fn +local eq = t.eq +local clear = t.clear +local command = t.command +local pathsep = t.get_pathsep() +local is_os = t.is_os +local api = t.api +local exec_lua = t.exec_lua +local feed_command = t.feed_command +local feed = t.feed +local fn = t.fn local stdpath = fn.stdpath -local pcall_err = helpers.pcall_err -local matches = helpers.matches -local read_file = helpers.read_file +local pcall_err = t.pcall_err +local matches = t.matches +local read_file = t.read_file describe('vim.secure', function() describe('read()', function() @@ -22,8 +22,8 @@ describe('vim.secure', function() setup(function() clear { env = { XDG_STATE_HOME = xstate } } - helpers.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim')) - helpers.write_file( + t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim')) + t.write_file( 'Xfile', [[ let g:foobar = 42 @@ -33,7 +33,7 @@ describe('vim.secure', function() teardown(function() os.remove('Xfile') - helpers.rmdir(xstate) + t.rmdir(xstate) end) it('works', function() @@ -181,15 +181,15 @@ describe('vim.secure', function() setup(function() clear { env = { XDG_STATE_HOME = xstate } } - helpers.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim')) + t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim')) end) teardown(function() - helpers.rmdir(xstate) + t.rmdir(xstate) end) before_each(function() - helpers.write_file('test_file', 'test') + t.write_file('test_file', 'test') end) after_each(function() diff --git a/test/functional/lua/snippet_spec.lua b/test/functional/lua/snippet_spec.lua index d31b8cc7d5..f1d0493f6e 100644 --- a/test/functional/lua/snippet_spec.lua +++ b/test/functional/lua/snippet_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.functional.helpers')(after_each) - -local buf_lines = helpers.buf_lines -local clear = helpers.clear -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local api = helpers.api -local fn = helpers.fn -local matches = helpers.matches -local pcall_err = helpers.pcall_err -local poke_eventloop = helpers.poke_eventloop -local retry = helpers.retry +local t = require('test.functional.testutil')(after_each) + +local buf_lines = t.buf_lines +local clear = t.clear +local eq = t.eq +local exec_lua = t.exec_lua +local feed = t.feed +local api = t.api +local fn = t.fn +local matches = t.matches +local pcall_err = t.pcall_err +local poke_eventloop = t.poke_eventloop +local retry = t.retry describe('vim.snippet', function() before_each(function() diff --git a/test/functional/lua/spell_spec.lua b/test/functional/lua/spell_spec.lua index e82dd7b4a0..dad223dbe3 100644 --- a/test/functional/lua/spell_spec.lua +++ b/test/functional/lua/spell_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local pcall_err = t.pcall_err describe('vim.spell', function() before_each(function() diff --git a/test/functional/lua/system_spec.lua b/test/functional/lua/system_spec.lua index cb561f0771..ba1581bc6b 100644 --- a/test/functional/lua/system_spec.lua +++ b/test/functional/lua/system_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq local function system_sync(cmd, opts) return exec_lua( diff --git a/test/functional/lua/text_spec.lua b/test/functional/lua/text_spec.lua index e31aa63768..ecebb88af6 100644 --- a/test/functional/lua/text_spec.lua +++ b/test/functional/lua/text_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq describe('vim.text', function() before_each(clear) diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua index 9bbee73e27..6fb70c54d8 100644 --- a/test/functional/lua/thread_spec.lua +++ b/test/functional/lua/thread_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local feed = helpers.feed -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local next_msg = helpers.next_msg +local assert_alive = t.assert_alive +local clear = t.clear +local feed = t.feed +local eq = t.eq +local exec_lua = t.exec_lua +local next_msg = t.next_msg local NIL = vim.NIL -local pcall_err = helpers.pcall_err +local pcall_err = t.pcall_err describe('thread', function() local screen diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 39c51d242c..1283448db5 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local clear = helpers.clear -local feed = helpers.feed -local fn = helpers.fn -local assert_log = helpers.assert_log -local check_close = helpers.check_close +local eq = t.eq +local exec_lua = t.exec_lua +local clear = t.clear +local feed = t.feed +local fn = t.fn +local assert_log = t.assert_log +local check_close = t.check_close local testlog = 'Xtest_lua_ui_event_log' @@ -112,7 +112,7 @@ describe('vim.ui_attach', function() it('does not crash on exit', function() fn.system({ - helpers.nvim_prog, + t.nvim_prog, '-u', 'NONE', '-i', @@ -124,7 +124,7 @@ describe('vim.ui_attach', function() '--cmd', 'quitall!', }) - eq(0, helpers.eval('v:shell_error')) + eq(0, t.eval('v:shell_error')) end) it('can receive accurate message kinds even if they are history', function() diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua index e769843b19..eb0a58a4ee 100644 --- a/test/functional/lua/ui_spec.lua +++ b/test/functional/lua/ui_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local matches = helpers.matches -local exec_lua = helpers.exec_lua -local clear = helpers.clear -local feed = helpers.feed -local eval = helpers.eval -local is_ci = helpers.is_ci -local is_os = helpers.is_os -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local matches = t.matches +local exec_lua = t.exec_lua +local clear = t.clear +local feed = t.feed +local eval = t.eval +local is_ci = t.is_ci +local is_os = t.is_os +local poke_eventloop = t.poke_eventloop describe('vim.ui', function() before_each(function() diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua index dacaf95867..b759e9df21 100644 --- a/test/functional/lua/uri_spec.lua +++ b/test/functional/lua/uri_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local is_os = helpers.is_os -local skip = helpers.skip -local write_file = require('test.helpers').write_file +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local is_os = t.is_os +local skip = t.skip +local write_file = t.write_file describe('URI methods', function() before_each(function() @@ -206,7 +206,7 @@ describe('URI methods', function() it('Windows paths should not be treated as uris', function() skip(not is_os('win'), 'Not applicable on non-Windows') - local file = helpers.tmpname() + local file = t.tmpname() write_file(file, 'Test content') local test_case = string.format( [[ diff --git a/test/functional/lua/version_spec.lua b/test/functional/lua/version_spec.lua index 9f953daa9e..6f25aa3711 100644 --- a/test/functional/lua/version_spec.lua +++ b/test/functional/lua/version_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local ok = helpers.ok -local exec_lua = helpers.exec_lua -local matches = helpers.matches -local pcall_err = helpers.pcall_err -local fn = helpers.fn +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local ok = t.ok +local exec_lua = t.exec_lua +local matches = t.matches +local pcall_err = t.pcall_err +local fn = t.fn local function v(ver) return vim.version._version(ver) diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 8722c4dbb5..3757d2843a 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -1,32 +1,32 @@ -- Test suite for testing interactions with API bindings -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local nvim_prog = helpers.nvim_prog -local fn = helpers.fn -local api = helpers.api -local command = helpers.command -local dedent = helpers.dedent -local insert = helpers.insert -local clear = helpers.clear -local eq = helpers.eq -local ok = helpers.ok +local nvim_prog = t.nvim_prog +local fn = t.fn +local api = t.api +local command = t.command +local dedent = t.dedent +local insert = t.insert +local clear = t.clear +local eq = t.eq +local ok = t.ok local pesc = vim.pesc -local eval = helpers.eval -local feed = helpers.feed -local pcall_err = helpers.pcall_err -local exec_lua = helpers.exec_lua -local matches = helpers.matches -local exec = helpers.exec +local eval = t.eval +local feed = t.feed +local pcall_err = t.pcall_err +local exec_lua = t.exec_lua +local matches = t.matches +local exec = t.exec local NIL = vim.NIL -local retry = helpers.retry -local next_msg = helpers.next_msg -local remove_trace = helpers.remove_trace -local mkdir_p = helpers.mkdir_p -local rmdir = helpers.rmdir -local write_file = helpers.write_file -local poke_eventloop = helpers.poke_eventloop -local assert_alive = helpers.assert_alive +local retry = t.retry +local next_msg = t.next_msg +local remove_trace = t.remove_trace +local mkdir_p = t.mkdir_p +local rmdir = t.rmdir +local write_file = t.write_file +local poke_eventloop = t.poke_eventloop +local assert_alive = t.assert_alive describe('lua stdlib', function() before_each(clear) @@ -592,8 +592,8 @@ describe('lua stdlib', function() { 'x*yz*oo*l', '*', true, false, { 'x', 'yz', 'oo', 'l' } }, } - for _, t in ipairs(tests) do - eq(t[5], vim.split(t[1], t[2], { plain = t[3], trimempty = t[4] }), t[1]) + for _, q in ipairs(tests) do + eq(q[5], vim.split(q[1], q[2], { plain = q[3], trimempty = q[4] }), q[1]) end -- Test old signature @@ -603,8 +603,8 @@ describe('lua stdlib', function() { 'abc', '.-' }, } - for _, t in ipairs(loops) do - matches('Infinite loop detected', pcall_err(vim.split, t[1], t[2])) + for _, q in ipairs(loops) do + matches('Infinite loop detected', pcall_err(vim.split, q[1], q[2])) end -- Validates args. @@ -626,8 +626,8 @@ describe('lua stdlib', function() { 'r\n', 'r' }, } - for _, t in ipairs(trims) do - assert(t[2], trim(t[1])) + for _, q in ipairs(trims) do + assert(q[2], trim(q[1])) end -- Validates args. @@ -636,8 +636,8 @@ describe('lua stdlib', function() it('vim.inspect', function() -- just make sure it basically works, it has its own test suite - local inspect = function(t, opts) - return exec_lua('return vim.inspect(...)', t, opts) + local inspect = function(q, opts) + return exec_lua('return vim.inspect(...)', q, opts) end eq('2', inspect(2)) @@ -1569,7 +1569,7 @@ describe('lua stdlib', function() eq(NIL, exec_lua([[return vim.g.Unknown_script_func]])) -- Check if autoload works properly - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() local xconfig = 'Xhome' .. pathsep .. 'Xconfig' local xdata = 'Xhome' .. pathsep .. 'Xdata' local autoload_folder = table.concat({ xconfig, 'nvim', 'autoload' }, pathsep) @@ -4071,7 +4071,7 @@ describe('vim.keymap', function() feed('asdf\n') eq(1, exec_lua [[return GlobalCount]]) - eq('\nNo mapping found', helpers.exec_capture('nmap asdf')) + eq('\nNo mapping found', t.exec_capture('nmap asdf')) end) it('works with buffer-local mappings', function() @@ -4095,7 +4095,7 @@ describe('vim.keymap', function() feed('asdf\n') eq(1, exec_lua [[return GlobalCount]]) - eq('\nNo mapping found', helpers.exec_capture('nmap asdf')) + eq('\nNo mapping found', t.exec_capture('nmap asdf')) end) it('does not mutate the opts parameter', function() diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua index 0da4b3164d..392ad07572 100644 --- a/test/functional/lua/watch_spec.lua +++ b/test/functional/lua/watch_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local clear = helpers.clear -local is_ci = helpers.is_ci -local is_os = helpers.is_os -local skip = helpers.skip +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local exec_lua = t.exec_lua +local clear = t.clear +local is_ci = t.is_ci +local is_os = t.is_os +local skip = t.skip -- Create a file via a rename to avoid multiple -- events which can happen with some backends on some platforms local function touch(path) - local tmp = helpers.tmpname() + local tmp = t.tmpname() io.open(tmp, 'w'):close() assert(vim.uv.fs_rename(tmp, path)) end @@ -24,10 +24,7 @@ describe('vim._watch', function() if watchfunc == 'fswatch' then skip(is_os('win'), 'not supported on windows') skip(is_os('mac'), 'flaky test on mac') - skip( - not is_ci() and helpers.fn.executable('fswatch') == 0, - 'fswatch not installed and not on CI' - ) + skip(not is_ci() and t.fn.executable('fswatch') == 0, 'fswatch not installed and not on CI') end if watchfunc == 'watch' then @@ -40,7 +37,7 @@ describe('vim._watch', function() ) end - local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX') + local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(t.tmpname()) .. '/nvim_XXXXXXXXXX') local expected_events = 0 diff --git a/test/functional/lua/xdiff_spec.lua b/test/functional/lua/xdiff_spec.lua index c21309c2e4..3a264385da 100644 --- a/test/functional/lua/xdiff_spec.lua +++ b/test/functional/lua/xdiff_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local pcall_err = t.pcall_err describe('xdiff bindings', function() before_each(function() diff --git a/test/functional/options/autochdir_spec.lua b/test/functional/options/autochdir_spec.lua index 11f71912a9..b05656b043 100644 --- a/test/functional/options/autochdir_spec.lua +++ b/test/functional/options/autochdir_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local fn = helpers.fn -local command = helpers.command -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local fn = t.fn +local command = t.command +local mkdir = t.mkdir describe("'autochdir'", function() it('given on the shell gets processed properly', function() @@ -16,7 +16,7 @@ describe("'autochdir'", function() -- With 'autochdir' on, we should get the directory of tty-test.c. clear('--cmd', 'set autochdir', targetdir .. '/tty-test.c') - eq(helpers.is_os('win') and expected:gsub('/', '\\') or expected, fn.getcwd()) + eq(t.is_os('win') and expected:gsub('/', '\\') or expected, fn.getcwd()) end) it('is not overwritten by getwinvar() call #17609', function() @@ -38,7 +38,7 @@ describe("'autochdir'", function() eq(dir_a, fn.getcwd()) fn.getwinvar(2, 'foo') eq(dir_a, fn.getcwd()) - helpers.rmdir(dir_a) - helpers.rmdir(dir_b) + t.rmdir(dir_a) + t.rmdir(dir_b) end) end) diff --git a/test/functional/options/chars_spec.lua b/test/functional/options/chars_spec.lua index 2348c5fc1a..9b902092db 100644 --- a/test/functional/options/chars_spec.lua +++ b/test/functional/options/chars_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, command = helpers.clear, helpers.command -local pcall_err = helpers.pcall_err -local eval = helpers.eval -local eq = helpers.eq -local insert = helpers.insert -local feed = helpers.feed -local api = helpers.api +local clear, command = t.clear, t.command +local pcall_err = t.pcall_err +local eval = t.eval +local eq = t.eq +local insert = t.insert +local feed = t.feed +local api = t.api describe("'fillchars'", function() local screen diff --git a/test/functional/options/cursorbind_spec.lua b/test/functional/options/cursorbind_spec.lua index cafdc83de2..2985cc877f 100644 --- a/test/functional/options/cursorbind_spec.lua +++ b/test/functional/options/cursorbind_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local feed = helpers.feed +local clear = t.clear +local command = t.command +local exec = t.exec +local feed = t.feed before_each(clear) diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index 5bf9aa5ac9..a2fd0afe48 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -1,27 +1,27 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local assert_log = helpers.assert_log -local api = helpers.api -local command = helpers.command -local clear = helpers.clear -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local eval = helpers.eval -local eq = helpers.eq -local ok = helpers.ok -local fn = helpers.fn -local insert = helpers.insert -local neq = helpers.neq -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local alter_slashes = helpers.alter_slashes +local assert_alive = t.assert_alive +local assert_log = t.assert_log +local api = t.api +local command = t.command +local clear = t.clear +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local eval = t.eval +local eq = t.eq +local ok = t.ok +local fn = t.fn +local insert = t.insert +local neq = t.neq +local mkdir = t.mkdir +local rmdir = t.rmdir +local alter_slashes = t.alter_slashes local tbl_contains = vim.tbl_contains -local expect_exit = helpers.expect_exit -local check_close = helpers.check_close -local is_os = helpers.is_os +local expect_exit = t.expect_exit +local check_close = t.check_close +local is_os = t.is_os local testlog = 'Xtest-defaults-log' @@ -1248,7 +1248,7 @@ end) describe('autocommands', function() it('closes terminal with default shell on success', function() clear() - api.nvim_set_option_value('shell', helpers.testprg('shell-test'), {}) + api.nvim_set_option_value('shell', t.testprg('shell-test'), {}) command('set shellcmdflag=EXIT shellredir= shellpipe= shellquote= shellxquote=') -- Should not block other events @@ -1258,7 +1258,7 @@ describe('autocommands', function() command('terminal') eq(1, eval('get(g:, "n", 0)')) - helpers.retry(nil, 1000, function() + t.retry(nil, 1000, function() neq('terminal', api.nvim_get_option_value('buftype', { buf = 0 })) eq(2, eval('get(g:, "n", 0)')) end) diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua index 7be58888bc..4b1b3fbd3f 100644 --- a/test/functional/options/keymap_spec.lua +++ b/test/functional/options/keymap_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq -local expect, command, eval = helpers.expect, helpers.command, helpers.eval -local insert, call = helpers.insert, helpers.call -local exec_capture, dedent = helpers.exec_capture, helpers.dedent +local t = require('test.functional.testutil')(after_each) +local clear, feed, eq = t.clear, t.feed, t.eq +local expect, command, eval = t.expect, t.command, t.eval +local insert, call = t.insert, t.call +local exec_capture, dedent = t.exec_capture, t.dedent -- First test it's implemented using the :lmap and :lnoremap commands, then -- check those mappings behave as expected. diff --git a/test/functional/options/modified_spec.lua b/test/functional/options/modified_spec.lua index 4fb80c255d..ab468c4ec8 100644 --- a/test/functional/options/modified_spec.lua +++ b/test/functional/options/modified_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local api = t.api describe("'modified'", function() before_each(function() diff --git a/test/functional/options/mousescroll_spec.lua b/test/functional/options/mousescroll_spec.lua index 96af8987b8..82a9c5ad8a 100644 --- a/test/functional/options/mousescroll_spec.lua +++ b/test/functional/options/mousescroll_spec.lua @@ -1,21 +1,21 @@ -local helpers = require('test.functional.helpers')(after_each) -local command = helpers.command -local clear = helpers.clear -local eval = helpers.eval -local eq = helpers.eq -local exc_exec = helpers.exc_exec -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local command = t.command +local clear = t.clear +local eval = t.eval +local eq = t.eq +local exc_exec = t.exc_exec +local feed = t.feed local scroll = function(direction) - return helpers.request('nvim_input_mouse', 'wheel', direction, '', 0, 2, 2) + return t.request('nvim_input_mouse', 'wheel', direction, '', 0, 2, 2) end local screenrow = function() - return helpers.call('screenrow') + return t.call('screenrow') end local screencol = function() - return helpers.call('screencol') + return t.call('screencol') end describe("'mousescroll'", function() diff --git a/test/functional/options/num_options_spec.lua b/test/functional/options/num_options_spec.lua index 3b411b109c..ac7ecd4ab9 100644 --- a/test/functional/options/num_options_spec.lua +++ b/test/functional/options/num_options_spec.lua @@ -1,8 +1,7 @@ -- Tests for :setlocal and :setglobal -local helpers = require('test.functional.helpers')(after_each) -local clear, feed_command, eval, eq, api = - helpers.clear, helpers.feed_command, helpers.eval, helpers.eq, helpers.api +local t = require('test.functional.testutil')(after_each) +local clear, feed_command, eval, eq, api = t.clear, t.feed_command, t.eval, t.eq, t.api local function should_fail(opt, value, errmsg) feed_command('setglobal ' .. opt .. '=' .. value) diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua index e05f231f42..b2f82d548b 100644 --- a/test/functional/options/shortmess_spec.lua +++ b/test/functional/options/shortmess_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed describe("'shortmess'", function() local screen diff --git a/test/functional/options/tabstop_spec.lua b/test/functional/options/tabstop_spec.lua index 9070db8257..36aed914b1 100644 --- a/test/functional/options/tabstop_spec.lua +++ b/test/functional/options/tabstop_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local feed = helpers.feed +local assert_alive = t.assert_alive +local clear = t.clear +local feed = t.feed describe("'tabstop' option", function() before_each(function() diff --git a/test/functional/options/winfixbuf_spec.lua b/test/functional/options/winfixbuf_spec.lua index 20407b9bb7..7b214ac9cd 100644 --- a/test/functional/options/winfixbuf_spec.lua +++ b/test/functional/options/winfixbuf_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local exec_lua = helpers.exec_lua +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local exec_lua = t.exec_lua describe("Nvim API calls with 'winfixbuf'", function() before_each(function() diff --git a/test/functional/plugin/ccomplete_spec.lua b/test/functional/plugin/ccomplete_spec.lua index 903f16fc73..2133f28a2e 100644 --- a/test/functional/plugin/ccomplete_spec.lua +++ b/test/functional/plugin/ccomplete_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local write_file = helpers.write_file +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed +local write_file = t.write_file describe('ccomplete#Complete', function() setup(function() diff --git a/test/functional/plugin/cfilter_spec.lua b/test/functional/plugin/cfilter_spec.lua index 37261d59df..917e666ab0 100644 --- a/test/functional/plugin/cfilter_spec.lua +++ b/test/functional/plugin/cfilter_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local fn = helpers.fn +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local eq = t.eq +local fn = t.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 c8151d2005..cd524373da 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local pathsep = helpers.get_pathsep() -local fn = helpers.fn -local api = helpers.api -local exec_lua = helpers.exec_lua +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.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 testdir = 'Xtest-editorconfig' @@ -20,8 +20,8 @@ local function test_case(name, expected) end setup(function() - helpers.mkdir_p(testdir) - helpers.write_file( + t.mkdir_p(testdir) + t.write_file( testdir .. pathsep .. '.editorconfig', [[ root = true @@ -96,7 +96,7 @@ setup(function() end) teardown(function() - helpers.rmdir(testdir) + t.rmdir(testdir) end) describe('editorconfig', function() @@ -178,18 +178,18 @@ But not this one -- luacheck: pop local trimmed = untrimmed:gsub('%s+\n', '\n') - helpers.write_file(filename, untrimmed) + t.write_file(filename, untrimmed) command('edit ' .. filename) command('write') command('bdelete') - eq(trimmed, helpers.read_file(filename)) + eq(trimmed, t.read_file(filename)) filename = testdir .. pathsep .. 'no_trim.txt' - helpers.write_file(filename, untrimmed) + t.write_file(filename, untrimmed) command('edit ' .. filename) command('write') command('bdelete') - eq(untrimmed, helpers.read_file(filename)) + eq(untrimmed, t.read_file(filename)) end) it('sets textwidth', function() diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 8416f0e5f7..3fe9102886 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local curbuf_contents = helpers.curbuf_contents -local command = helpers.command -local eq, neq, matches = helpers.eq, helpers.neq, helpers.matches -local getcompletion = helpers.fn.getcompletion -local insert = helpers.insert -local source = helpers.source -local fn = helpers.fn -local api = helpers.api +local clear = t.clear +local curbuf_contents = t.curbuf_contents +local command = t.command +local eq, neq, matches = t.eq, t.neq, t.matches +local getcompletion = t.fn.getcompletion +local insert = t.insert +local source = t.source +local fn = t.fn +local api = t.api describe(':checkhealth', function() it('detects invalid $VIMRUNTIME', function() @@ -53,7 +53,7 @@ describe('health.vim', function() describe(':checkhealth', function() it('functions report_*() render correctly', function() command('checkhealth full_render') - helpers.expect([[ + t.expect([[ ============================================================================== test_plug.full_render: require("test_plug.full_render.health").check() @@ -76,7 +76,7 @@ describe('health.vim', function() it('concatenates multiple reports', function() command('checkhealth success1 success2 test_plug') - helpers.expect([[ + t.expect([[ ============================================================================== test_plug: require("test_plug.health").check() @@ -106,7 +106,7 @@ describe('health.vim', function() it('lua plugins submodules', function() command('checkhealth test_plug.submodule') - helpers.expect([[ + t.expect([[ ============================================================================== test_plug.submodule: require("test_plug.submodule.health").check() @@ -121,7 +121,7 @@ describe('health.vim', function() it('... including empty reports', function() command('checkhealth test_plug.submodule_empty') - helpers.expect([[ + t.expect([[ ============================================================================== test_plug.submodule_empty: require("test_plug.submodule_empty.health").check() @@ -180,7 +180,7 @@ describe('health.vim', function() it('gracefully handles invalid healthcheck', function() command('checkhealth non_existent_healthcheck') -- luacheck: ignore 613 - helpers.expect([[ + t.expect([[ ============================================================================== non_existent_healthcheck: @@ -192,7 +192,7 @@ describe('health.vim', function() it('does not use vim.health as a healtcheck', function() -- vim.health is not a healthcheck command('checkhealth vim') - helpers.expect([[ + t.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 29daf7a066..a618854e2f 100644 --- a/test/functional/plugin/lsp/codelens_spec.lua +++ b/test/functional/plugin/lsp/codelens_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq +local exec_lua = t.exec_lua +local eq = t.eq describe('vim.lsp.codelens', function() before_each(function() - helpers.clear() + t.clear() exec_lua('require("vim.lsp")') end) - after_each(helpers.clear) + after_each(t.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 655eb76be6..fd29a11ead 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -1,7 +1,7 @@ ---@diagnostic disable: no-unknown -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local exec_lua = t.exec_lua --- Convert completion results. --- @@ -41,7 +41,7 @@ local function complete(line, candidates, lnum) end describe('vim.lsp._completion', function() - before_each(helpers.clear) + before_each(t.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 72531db021..ffff677ad6 100644 --- a/test/functional/plugin/lsp/diagnostic_spec.lua +++ b/test/functional/plugin/lsp/diagnostic_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local lsp_helpers = require('test.functional.plugin.lsp.helpers') +local t = require('test.functional.testutil')(after_each) +local t_lsp = require('test.functional.plugin.lsp.testutil') -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local neq = require('test.helpers').neq +local clear = t.clear +local exec_lua = t.exec_lua +local eq = t.eq +local neq = t.neq -local create_server_definition = lsp_helpers.create_server_definition +local create_server_definition = t_lsp.create_server_definition describe('vim.lsp.diagnostic', function() local fake_uri diff --git a/test/functional/plugin/lsp/handler_spec.lua b/test/functional/plugin/lsp/handler_spec.lua index 56e29e7337..04e4fc8b8e 100644 --- a/test/functional/plugin/lsp/handler_spec.lua +++ b/test/functional/plugin/lsp/handler_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local pcall_err = helpers.pcall_err -local matches = helpers.matches +local eq = t.eq +local exec_lua = t.exec_lua +local pcall_err = t.pcall_err +local matches = t.matches describe('lsp-handlers', function() describe('vim.lsp._with_extend', function() diff --git a/test/functional/plugin/lsp/incremental_sync_spec.lua b/test/functional/plugin/lsp/incremental_sync_spec.lua index bd1842ceb5..eed182150e 100644 --- a/test/functional/plugin/lsp/incremental_sync_spec.lua +++ b/test/functional/plugin/lsp/incremental_sync_spec.lua @@ -1,11 +1,11 @@ -- Test suite for testing interactions with the incremental sync algorithms powering the LSP client -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local api = helpers.api -local clear = helpers.clear -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local feed = helpers.feed +local api = t.api +local clear = t.clear +local eq = t.eq +local exec_lua = t.exec_lua +local feed = t.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 e9c347bcc5..dceaf45bca 100644 --- a/test/functional/plugin/lsp/inlay_hint_spec.lua +++ b/test/functional/plugin/lsp/inlay_hint_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) -local lsp_helpers = require('test.functional.plugin.lsp.helpers') +local t = require('test.functional.testutil')(after_each) +local t_lsp = require('test.functional.plugin.lsp.testutil') local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local dedent = helpers.dedent -local exec_lua = helpers.exec_lua -local insert = helpers.insert -local api = helpers.api +local eq = t.eq +local dedent = t.dedent +local exec_lua = t.exec_lua +local insert = t.insert +local api = t.api -local clear_notrace = lsp_helpers.clear_notrace -local create_server_definition = lsp_helpers.create_server_definition +local clear_notrace = t_lsp.clear_notrace +local create_server_definition = t_lsp.create_server_definition local text = dedent([[ auto add(int a, int b) { return a + b; } diff --git a/test/functional/plugin/lsp/semantic_tokens_spec.lua b/test/functional/plugin/lsp/semantic_tokens_spec.lua index 12f6e09e7e..82450e404e 100644 --- a/test/functional/plugin/lsp/semantic_tokens_spec.lua +++ b/test/functional/plugin/lsp/semantic_tokens_spec.lua @@ -1,19 +1,19 @@ -local helpers = require('test.functional.helpers')(after_each) -local lsp_helpers = require('test.functional.plugin.lsp.helpers') +local t = require('test.functional.testutil')(after_each) +local t_lsp = require('test.functional.plugin.lsp.testutil') local Screen = require('test.functional.ui.screen') -local command = helpers.command -local dedent = helpers.dedent -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local feed_command = helpers.feed_command -local insert = helpers.insert -local matches = helpers.matches -local api = helpers.api - -local clear_notrace = lsp_helpers.clear_notrace -local create_server_definition = lsp_helpers.create_server_definition +local command = t.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 matches = t.matches +local api = t.api + +local clear_notrace = t_lsp.clear_notrace +local create_server_definition = t_lsp.create_server_definition before_each(function() clear_notrace() diff --git a/test/functional/plugin/lsp/snippet_spec.lua b/test/functional/plugin/lsp/snippet_spec.lua index ba8bc7fe04..d62e188dab 100644 --- a/test/functional/plugin/lsp/snippet_spec.lua +++ b/test/functional/plugin/lsp/snippet_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local snippet = require('vim.lsp._snippet_grammar') local type = snippet.NodeType -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local eq = t.eq +local exec_lua = t.exec_lua describe('vim.lsp._snippet_grammar', function() - before_each(helpers.clear) - after_each(helpers.clear) + before_each(t.clear) + after_each(t.clear) local parse = function(...) local res = exec_lua('return require("vim.lsp._snippet_grammar").parse(...)', ...) diff --git a/test/functional/plugin/lsp/helpers.lua b/test/functional/plugin/lsp/testutil.lua index fb93746480..7dc7bd9925 100644 --- a/test/functional/plugin/lsp/helpers.lua +++ b/test/functional/plugin/lsp/testutil.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(nil) +local t = require('test.functional.testutil')(nil) -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local run = helpers.run -local stop = helpers.stop -local api = helpers.api +local clear = t.clear +local exec_lua = t.exec_lua +local run = t.run +local stop = t.stop +local api = t.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 bb9cdb8390..c7b874d443 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed = helpers.feed +local feed = t.feed -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local eq = t.eq +local exec_lua = t.exec_lua describe('vim.lsp.util', function() - before_each(helpers.clear) + before_each(t.clear) describe('stylize_markdown', function() local stylize_markdown = function(content, opts) @@ -142,7 +142,7 @@ describe('vim.lsp.util', function() local screen before_each(function() - helpers.clear() + t.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 c65cca6cb7..a7dd0537c3 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -1,36 +1,36 @@ -local helpers = require('test.functional.helpers')(after_each) -local lsp_helpers = require('test.functional.plugin.lsp.helpers') - -local assert_log = helpers.assert_log -local buf_lines = helpers.buf_lines -local clear = helpers.clear -local command = helpers.command -local dedent = helpers.dedent -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local eval = helpers.eval -local matches = helpers.matches -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +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 dedent = t.dedent +local exec_lua = t.exec_lua +local eq = t.eq +local eval = t.eval +local matches = t.matches +local pcall_err = t.pcall_err local pesc = vim.pesc -local insert = helpers.insert -local fn = helpers.fn -local retry = helpers.retry -local stop = helpers.stop +local insert = t.insert +local fn = t.fn +local retry = t.retry +local stop = t.stop local NIL = vim.NIL -local read_file = helpers.read_file -local write_file = helpers.write_file -local is_ci = helpers.is_ci -local api = helpers.api -local is_os = helpers.is_os -local skip = helpers.skip -local mkdir = helpers.mkdir -local tmpname = helpers.tmpname - -local clear_notrace = lsp_helpers.clear_notrace -local create_server_definition = lsp_helpers.create_server_definition -local fake_lsp_code = lsp_helpers.fake_lsp_code -local fake_lsp_logfile = lsp_helpers.fake_lsp_logfile -local test_rpc_server = lsp_helpers.test_rpc_server +local read_file = t.read_file +local write_file = t.write_file +local is_ci = t.is_ci +local api = t.api +local is_os = t.is_os +local skip = t.skip +local mkdir = t.mkdir +local tmpname = t.tmpname + +local clear_notrace = t_lsp.clear_notrace +local create_server_definition = t_lsp.create_server_definition +local fake_lsp_code = t_lsp.fake_lsp_code +local fake_lsp_logfile = t_lsp.fake_lsp_logfile +local test_rpc_server = t_lsp.test_rpc_server local function get_buf_option(name, bufnr) bufnr = bufnr or 'BUFFER' @@ -249,7 +249,7 @@ describe('LSP', function() if is_ci() then pending('hangs the build on CI #14028, re-enable with freeze timeout #14204') return - elseif helpers.skip_fragile(pending) then + elseif t.skip_fragile(pending) then return end local expected_handlers = { @@ -1481,7 +1481,7 @@ describe('LSP', function() end, on_handler = function(err, result, ctx) if ctx.method == 'start' then - helpers.command('normal! 1Go') + t.command('normal! 1Go') client.notify('finish') end eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler') @@ -2368,7 +2368,7 @@ describe('LSP', function() end) describe('lsp.util.rename', function() - local pathsep = helpers.get_pathsep() + local pathsep = t.get_pathsep() it('Can rename an existing file', function() local old = tmpname() @@ -2404,7 +2404,7 @@ describe('LSP', function() os.remove(old_dir) os.remove(new_dir) - helpers.mkdir_p(old_dir) + t.mkdir_p(old_dir) local file = 'file.txt' write_file(old_dir .. pathsep .. file, 'Test content') @@ -2440,7 +2440,7 @@ describe('LSP', function() local new = tmpname() os.remove(old) os.remove(new) - helpers.mkdir_p(old) + t.mkdir_p(old) local result = exec_lua( [[ diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index 34006d5906..862cb13146 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local command, feed = helpers.command, helpers.feed -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local fn = helpers.fn -local nvim_prog = helpers.nvim_prog -local matches = helpers.matches -local write_file = helpers.write_file -local tmpname = helpers.tmpname -local eq = helpers.eq +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 matches = t.matches +local write_file = t.write_file +local tmpname = t.tmpname +local eq = t.eq local pesc = vim.pesc -local skip = helpers.skip -local is_ci = helpers.is_ci +local skip = t.skip +local is_ci = t.is_ci -- Collects all names passed to find_path() after attempting ":Man foo". local function get_search_history(name) diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua index 619c43f2c9..93d747519a 100644 --- a/test/functional/plugin/matchparen_spec.lua +++ b/test/functional/plugin/matchparen_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local api = helpers.api -local feed = helpers.feed -local eq = helpers.eq +local clear = t.clear +local command = t.command +local api = t.api +local feed = t.feed +local eq = t.eq describe('matchparen', function() local screen --- @type test.functional.ui.screen diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua index 8511e6c703..76feca7911 100644 --- a/test/functional/plugin/msgpack_spec.lua +++ b/test/functional/plugin/msgpack_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local api = helpers.api -local eq = helpers.eq -local nvim_eval = helpers.eval -local nvim_command = helpers.command -local exc_exec = helpers.exc_exec -local ok = helpers.ok +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local api = t.api +local eq = t.eq +local nvim_eval = t.eval +local nvim_command = t.command +local exc_exec = t.exc_exec +local ok = t.ok local NIL = vim.NIL describe('autoload/msgpack.vim', function() diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index 1c20548321..9312f1f2f0 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear +local clear = t.clear local eq, api, nvim_eval, nvim_command, exc_exec, fn, nvim_feed = - helpers.eq, helpers.api, helpers.eval, helpers.command, helpers.exc_exec, helpers.fn, helpers.feed -local neq = helpers.neq -local read_file = helpers.read_file + t.eq, t.api, t.eval, t.command, t.exc_exec, t.fn, t.feed +local neq = t.neq +local read_file = t.read_file -local shada_helpers = require('test.functional.shada.helpers') -local get_shada_rw = shada_helpers.get_shada_rw +local t_shada = require('test.functional.shada.testutil') +local get_shada_rw = t_shada.get_shada_rw local function reset(shada_file) clear { args = { '-u', 'NORC', '-i', shada_file or 'NONE' } } @@ -2612,7 +2612,7 @@ end) describe('plugin/shada.vim', function() local epoch = os.date('%Y-%m-%dT%H:%M:%S', 0) - local eol = helpers.is_os('win') and '\r\n' or '\n' + local eol = t.is_os('win') and '\r\n' or '\n' before_each(function() -- Note: reset() is called explicitly in each test. os.remove(fname) diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index 2ac0fe1fa3..9d947fe44a 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -1,13 +1,13 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local fn = helpers.fn -local api = helpers.api -local insert = helpers.insert +local clear = t.clear +local exec = t.exec +local exec_lua = t.exec_lua +local eq = t.eq +local fn = t.fn +local api = t.api +local insert = t.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 46a117f298..d9ba8365d6 100644 --- a/test/functional/plugin/tutor_spec.lua +++ b/test/functional/plugin/tutor_spec.lua @@ -1,9 +1,9 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local command = t.command +local feed = t.feed +local is_os = t.is_os describe(':Tutor', function() local screen --- @type test.functional.ui.screen diff --git a/test/functional/plugin/vim_syntax_spec.lua b/test/functional/plugin/vim_syntax_spec.lua index c5858f8bc0..c07c5646a6 100644 --- a/test/functional/plugin/vim_syntax_spec.lua +++ b/test/functional/plugin/vim_syntax_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local api = helpers.api +local clear = t.clear +local exec = t.exec +local api = t.api describe('Vimscript syntax highlighting', function() local screen --- @type test.functional.ui.screen before_each(function() clear() - helpers.add_builddir_to_rtp() + t.add_builddir_to_rtp() exec([[ setfiletype vim syntax on diff --git a/test/functional/preload.lua b/test/functional/preload.lua index 49f1eff0da..8c3aff146d 100644 --- a/test/functional/preload.lua +++ b/test/functional/preload.lua @@ -1,10 +1,10 @@ -- Modules loaded here will NOT be cleared and reloaded by Busted. -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. -local helpers = require('test.functional.helpers')(nil) +local t = require('test.functional.testutil')(nil) require('test.functional.ui.screen') local busted = require('busted') -local is_os = helpers.is_os +local is_os = t.is_os if is_os('win') then local ffi = require('ffi') diff --git a/test/functional/provider/clipboard_spec.lua b/test/functional/provider/clipboard_spec.lua index 0c4fd7aaa0..b3af7e3e0f 100644 --- a/test/functional/provider/clipboard_spec.lua +++ b/test/functional/provider/clipboard_spec.lua @@ -1,12 +1,11 @@ -- Test clipboard provider support -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local feed_command, expect, eq, eval, source = - helpers.feed_command, helpers.expect, helpers.eq, helpers.eval, helpers.source -local command = helpers.command -local api = helpers.api +local clear, feed, insert = t.clear, t.feed, t.insert +local feed_command, expect, eq, eval, source = t.feed_command, t.expect, t.eq, t.eval, t.source +local command = t.command +local api = t.api local function basic_register_test(noblock) insert('some words') diff --git a/test/functional/provider/define_spec.lua b/test/functional/provider/define_spec.lua index 657f1a0d8a..0de8458400 100644 --- a/test/functional/provider/define_spec.lua +++ b/test/functional/provider/define_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local eval, command = helpers.eval, helpers.command -local eq, run, stop = helpers.eq, helpers.run, helpers.stop -local clear = helpers.clear -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local eval, command = t.eval, t.command +local eq, run, stop = t.eq, t.run, t.stop +local clear = t.clear +local api = t.api local function get_prefix(sync) if sync then @@ -28,7 +28,7 @@ local function runx(sync, handler, on_setup) local function setup_cb(...) on_setup(...) -- need to stop on setup callback because there's two session:request - -- calls in `request/helpers.lua`. The second call will always return + -- calls in `request/t.lua`. The second call will always return -- after pending notification/request callbacks are processed stop() end @@ -324,7 +324,7 @@ local function function_specs_for(fn, sync, first_arg_factory, init) end) it('with range', function() - helpers.insert([[ + t.insert([[ foo bar baz diff --git a/test/functional/provider/nodejs_spec.lua b/test/functional/provider/nodejs_spec.lua index 1769239cb0..beed71c120 100644 --- a/test/functional/provider/nodejs_spec.lua +++ b/test/functional/provider/nodejs_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, clear = helpers.eq, helpers.clear -local missing_provider = helpers.missing_provider -local command = helpers.command -local write_file = helpers.write_file -local eval = helpers.eval -local retry = helpers.retry +local t = require('test.functional.testutil')(after_each) +local eq, clear = t.eq, t.clear +local missing_provider = t.missing_provider +local command = t.command +local write_file = t.write_file +local eval = t.eval +local retry = t.retry do clear() diff --git a/test/functional/provider/perl_spec.lua b/test/functional/provider/perl_spec.lua index e9a031eb07..b1293596a6 100644 --- a/test/functional/provider/perl_spec.lua +++ b/test/functional/provider/perl_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, clear = helpers.eq, helpers.clear -local missing_provider = helpers.missing_provider -local command = helpers.command -local write_file = helpers.write_file -local eval = helpers.eval -local retry = helpers.retry -local api = helpers.api -local insert = helpers.insert -local expect = helpers.expect -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local eq, clear = t.eq, t.clear +local missing_provider = t.missing_provider +local command = t.command +local write_file = t.write_file +local eval = t.eval +local retry = t.retry +local api = t.api +local insert = t.insert +local expect = t.expect +local feed = t.feed do clear() diff --git a/test/functional/provider/provider_spec.lua b/test/functional/provider/provider_spec.lua index cccd1a1184..e965aa5240 100644 --- a/test/functional/provider/provider_spec.lua +++ b/test/functional/provider/provider_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eval = helpers.clear, helpers.eval -local command = helpers.command -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear, eval = t.clear, t.eval +local command = t.command +local eq = t.eq +local pcall_err = t.pcall_err describe('providers', function() before_each(function() diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua index 80b3552e82..5274054e7e 100644 --- a/test/functional/provider/python3_spec.lua +++ b/test/functional/provider/python3_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_alive = helpers.assert_alive -local eval, command, feed = helpers.eval, helpers.command, helpers.feed -local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert -local expect, write_file = helpers.expect, helpers.write_file -local feed_command = helpers.feed_command -local source = helpers.source -local missing_provider = helpers.missing_provider -local matches = helpers.matches -local pcall_err = helpers.pcall_err -local fn = helpers.fn -local dedent = helpers.dedent +local t = require('test.functional.testutil')(after_each) +local assert_alive = t.assert_alive +local eval, command, feed = t.eval, t.command, t.feed +local eq, clear, insert = t.eq, t.clear, t.insert +local expect, write_file = t.expect, t.write_file +local feed_command = t.feed_command +local source = t.source +local missing_provider = t.missing_provider +local matches = t.matches +local pcall_err = t.pcall_err +local fn = t.fn +local dedent = t.dedent do clear() @@ -153,7 +153,7 @@ describe('python3 provider', function() end) it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function() - helpers.add_builddir_to_rtp() + t.add_builddir_to_rtp() source([=[ python3 << EOF import vim diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua index 9b2531a23c..1a1e264dea 100644 --- a/test/functional/provider/ruby_spec.lua +++ b/test/functional/provider/ruby_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.functional.helpers')(after_each) - -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local exc_exec = helpers.exc_exec -local expect = helpers.expect -local feed = helpers.feed -local feed_command = helpers.feed_command -local fn = helpers.fn -local insert = helpers.insert -local api = helpers.api -local missing_provider = helpers.missing_provider -local matches = helpers.matches -local write_file = helpers.write_file -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) + +local assert_alive = t.assert_alive +local clear = t.clear +local command = t.command +local eq = t.eq +local exc_exec = t.exc_exec +local expect = t.expect +local feed = t.feed +local feed_command = t.feed_command +local fn = t.fn +local insert = t.insert +local api = t.api +local missing_provider = t.missing_provider +local matches = t.matches +local write_file = t.write_file +local pcall_err = t.pcall_err do clear() @@ -103,7 +103,7 @@ end) describe('ruby provider', function() it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function() - helpers.add_builddir_to_rtp() + t.add_builddir_to_rtp() command([=[autocmd BufDelete * ruby VIM::evaluate('expand("<afile>")')]=]) feed_command('help help') assert_alive() diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua index c3ac9fe722..40a0f87594 100644 --- a/test/functional/script/luacats_grammar_spec.lua +++ b/test/functional/script/luacats_grammar_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local eq = t.eq local grammar = require('scripts/luacats_grammar') diff --git a/test/functional/script/luacats_parser_spec.lua b/test/functional/script/luacats_parser_spec.lua index e10aa81003..ae23fd2648 100644 --- a/test/functional/script/luacats_parser_spec.lua +++ b/test/functional/script/luacats_parser_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local eq = t.eq local parser = require('scripts/luacats_parser') diff --git a/test/functional/script/text_utils_spec.lua b/test/functional/script/text_utils_spec.lua index 190c617e1d..5e6ea0f2a5 100644 --- a/test/functional/script/text_utils_spec.lua +++ b/test/functional/script/text_utils_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local exec_lua = t.exec_lua +local eq = t.eq local function md_to_vimdoc(text, start_indent, indent, text_width) return exec_lua( @@ -28,7 +28,7 @@ end describe('md_to_vimdoc', function() before_each(function() - helpers.clear() + t.clear() end) test('can render para after fenced code', { diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua index 9fead98fed..dcc37d2f3d 100644 --- a/test/functional/shada/buffers_spec.lua +++ b/test/functional/shada/buffers_spec.lua @@ -1,10 +1,10 @@ -- shada buffer list saving/reading support -local helpers = require('test.functional.helpers')(after_each) -local nvim_command, fn, eq, api = helpers.command, helpers.fn, helpers.eq, helpers.api -local expect_exit = helpers.expect_exit +local t = require('test.functional.testutil')(after_each) +local nvim_command, fn, eq, api = t.command, t.fn, t.eq, t.api +local expect_exit = t.expect_exit -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear = shada_helpers.reset, shada_helpers.clear +local t_shada = require('test.functional.shada.testutil') +local reset, clear = t_shada.reset, t_shada.clear describe('shada support code', function() local testfilename = 'Xtestfile-functional-shada-buffers' diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua index bc4e9675c6..943024f463 100644 --- a/test/functional/shada/compatibility_spec.lua +++ b/test/functional/shada/compatibility_spec.lua @@ -1,18 +1,17 @@ -- ShaDa compatibility support -local helpers = require('test.functional.helpers')(after_each) -local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq -local exc_exec = helpers.exc_exec +local t = require('test.functional.testutil')(after_each) +local nvim_command, fn, eq = t.command, t.fn, t.eq +local exc_exec = t.exc_exec -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear, get_shada_rw = - shada_helpers.reset, shada_helpers.clear, shada_helpers.get_shada_rw -local read_shada_file = shada_helpers.read_shada_file +local t_shada = require('test.functional.shada.testutil') +local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw +local read_shada_file = t_shada.read_shada_file local wshada, sdrcmd, shada_fname = get_shada_rw('Xtest-functional-shada-compatibility.shada') local mock_file_path = '/a/b/' local mock_file_path2 = '/d/e/' -if helpers.is_os('win') then +if t.is_os('win') then mock_file_path = 'C:/a/' mock_file_path2 = 'C:/d/' end diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua index 233f03e5c0..1ad9eb70ea 100644 --- a/test/functional/shada/errors_spec.lua +++ b/test/functional/shada/errors_spec.lua @@ -1,10 +1,9 @@ -- ShaDa errors handling support -local helpers = require('test.functional.helpers')(after_each) -local nvim_command, eq, exc_exec = helpers.command, helpers.eq, helpers.exc_exec +local t = require('test.functional.testutil')(after_each) +local nvim_command, eq, exc_exec = t.command, t.eq, t.exc_exec -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear, get_shada_rw = - shada_helpers.reset, shada_helpers.clear, shada_helpers.get_shada_rw +local t_shada = require('test.functional.shada.testutil') +local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw local wshada, sdrcmd, shada_fname, clean = get_shada_rw('Xtest-functional-shada-errors.shada') diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua index c8a19bb082..9ebf18ccdf 100644 --- a/test/functional/shada/history_spec.lua +++ b/test/functional/shada/history_spec.lua @@ -1,12 +1,11 @@ -- ShaDa history saving/reading support -local helpers = require('test.functional.helpers')(after_each) -local nvim_command, fn, api, nvim_feed, eq = - helpers.command, helpers.fn, helpers.api, helpers.feed, helpers.eq -local assert_alive = helpers.assert_alive -local expect_exit = helpers.expect_exit - -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear = shada_helpers.reset, shada_helpers.clear +local t = require('test.functional.testutil')(after_each) +local nvim_command, fn, api, nvim_feed, eq = t.command, t.fn, t.api, t.feed, t.eq +local assert_alive = t.assert_alive +local expect_exit = t.expect_exit + +local t_shada = require('test.functional.shada.testutil') +local reset, clear = t_shada.reset, t_shada.clear describe('ShaDa support code', function() before_each(reset) diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index 6eb1df38a3..7be6cc4d31 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -1,12 +1,12 @@ -- ShaDa marks saving/reading support -local helpers = require('test.functional.helpers')(after_each) -local api, nvim_command, fn, eq = helpers.api, helpers.command, helpers.fn, helpers.eq -local feed = helpers.feed -local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture -local expect_exit = helpers.expect_exit +local t = require('test.functional.testutil')(after_each) +local api, nvim_command, fn, eq = t.api, t.command, t.fn, t.eq +local feed = t.feed +local exc_exec, exec_capture = t.exc_exec, t.exec_capture +local expect_exit = t.expect_exit -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear = shada_helpers.reset, shada_helpers.clear +local t_shada = require('test.functional.shada.testutil') +local reset, clear = t_shada.reset, t_shada.clear local nvim_current_line = function() return api.nvim_win_get_cursor(0)[1] @@ -216,7 +216,7 @@ describe('ShaDa support code', function() -- -c temporary sets lnum to zero to make `+/pat` work, so calling setpcmark() -- during -c used to add item with zero lnum to jump list. it('does not create incorrect file for non-existent buffers when writing from -c', function() - local argv = helpers.new_argv { + local argv = t.new_argv { args_rm = { '-i', '--embed', -- no --embed @@ -235,7 +235,7 @@ describe('ShaDa support code', function() end) it('does not create incorrect file for non-existent buffers opened from -c', function() - local argv = helpers.new_argv { + local argv = t.new_argv { args_rm = { '-i', '--embed', -- no --embed diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua index ff81ce4eb9..2ca481df07 100644 --- a/test/functional/shada/merging_spec.lua +++ b/test/functional/shada/merging_spec.lua @@ -1,18 +1,17 @@ -- ShaDa merging data support -local helpers = require('test.functional.helpers')(after_each) -local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq -local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local nvim_command, fn, eq = t.command, t.fn, t.eq +local exc_exec, exec_capture = t.exc_exec, t.exec_capture +local api = t.api -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear, get_shada_rw = - shada_helpers.reset, shada_helpers.clear, shada_helpers.get_shada_rw -local read_shada_file = shada_helpers.read_shada_file +local t_shada = require('test.functional.shada.testutil') +local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw +local read_shada_file = t_shada.read_shada_file local wshada, sdrcmd, shada_fname = get_shada_rw('Xtest-functional-shada-merging.shada') local mock_file_path = '/a/b/' -if helpers.is_os('win') then +if t.is_os('win') then mock_file_path = 'C:/a/' end @@ -698,9 +697,9 @@ describe('ShaDa marks support code', function() for _, v in ipairs(read_shada_file(shada_fname)) do if v.type == 7 then local name = ('%c'):format(v.value.n) - local t = found[name] or {} - t[v.value.f] = (t[v.value.f] or 0) + 1 - found[name] = t + local _t = found[name] or {} + _t[v.value.f] = (_t[v.value.f] or 0) + 1 + found[name] = _t end end eq({ ['0'] = { [mock_file_path .. '-'] = 1 }, A = { [mock_file_path .. '?'] = 1 } }, found) @@ -1018,14 +1017,14 @@ describe('ShaDa jumps support code', function() eq(0, exc_exec(sdrcmd())) shada = '' for i = 1, 101 do - local t = i * 2 + local _t = i * 2 shada = shada .. ('\008\204%c\019\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161l\204%c'):format( - t, - t + _t, + _t ) - jumps[(t > #jumps + 1) and (#jumps + 1) or t] = - { file = '' .. mock_file_path .. 'c', line = t } + jumps[(_t > #jumps + 1) and (#jumps + 1) or _t] = + { file = '' .. mock_file_path .. 'c', line = _t } end wshada(shada) eq(0, exc_exec('wshada ' .. shada_fname)) @@ -1149,13 +1148,13 @@ describe('ShaDa changes support code', function() eq(0, exc_exec(sdrcmd())) shada = '' for i = 1, 101 do - local t = i * 2 + local _t = i * 2 shada = shada .. ('\011\204%c\019\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161l\204%c'):format( - t, - t + _t, + _t ) - changes[(t > #changes + 1) and (#changes + 1) or t] = { line = t } + changes[(_t > #changes + 1) and (#changes + 1) or _t] = { line = _t } end wshada(shada) eq(0, exc_exec('wshada ' .. shada_fname)) @@ -1178,11 +1177,11 @@ describe('ShaDa changes support code', function() nvim_command('keepjumps call setline(1, range(202))') local shada = '' for i = 1, 101 do - local t = i * 2 + local _t = i * 2 shada = shada .. ('\011\204%c\019\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161l\204%c'):format( - t, - t + _t, + _t ) end wshada(shada) @@ -1197,8 +1196,8 @@ describe('ShaDa changes support code', function() changes[i] = { line = i } end for i = 1, 101 do - local t = i * 2 - changes[(t > #changes + 1) and (#changes + 1) or t] = { line = t } + local _t = i * 2 + changes[(_t > #changes + 1) and (#changes + 1) or _t] = { line = _t } end wshada(shada) eq(0, exc_exec('wshada ' .. shada_fname)) diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua index ef15ab9a05..b8faf6012f 100644 --- a/test/functional/shada/registers_spec.lua +++ b/test/functional/shada/registers_spec.lua @@ -1,10 +1,10 @@ -- ShaDa registers saving/reading support -local helpers = require('test.functional.helpers')(after_each) -local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq +local t = require('test.functional.testutil')(after_each) +local nvim_command, fn, eq = t.command, t.fn, t.eq -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear = shada_helpers.reset, shada_helpers.clear -local expect_exit = helpers.expect_exit +local t_shada = require('test.functional.shada.testutil') +local reset, clear = t_shada.reset, t_shada.clear +local expect_exit = t.expect_exit local setreg = function(name, contents, typ) if type(contents) == 'string' then diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua index 6eb318015d..938490aecb 100644 --- a/test/functional/shada/shada_spec.lua +++ b/test/functional/shada/shada_spec.lua @@ -1,18 +1,17 @@ -- Other ShaDa tests -local helpers = require('test.functional.helpers')(after_each) -local api, nvim_command, fn, eq = helpers.api, helpers.command, helpers.fn, helpers.eq +local t = require('test.functional.testutil')(after_each) +local api, nvim_command, fn, eq = t.api, t.command, t.fn, t.eq local write_file, spawn, set_session, nvim_prog, exc_exec = - helpers.write_file, helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.exc_exec -local is_os = helpers.is_os -local skip = helpers.skip + t.write_file, t.spawn, t.set_session, t.nvim_prog, t.exc_exec +local is_os = t.is_os +local skip = t.skip local uv = vim.uv -local paths = helpers.paths +local paths = t.paths -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear, get_shada_rw = - shada_helpers.reset, shada_helpers.clear, shada_helpers.get_shada_rw -local read_shada_file = shada_helpers.read_shada_file +local t_shada = require('test.functional.shada.testutil') +local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw +local read_shada_file = t_shada.read_shada_file local wshada, _, shada_fname, clean = get_shada_rw('Xtest-functional-shada-shada.shada') diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/testutil.lua index baa27889f3..9cf81ec87b 100644 --- a/test/functional/shada/helpers.lua +++ b/test/functional/shada/testutil.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(nil) -local api = helpers.api -local write_file = helpers.write_file -local concat_tables = helpers.concat_tables +local t = require('test.functional.testutil')(nil) +local api = t.api +local write_file = t.write_file +local concat_tables = t.concat_tables -local tmpname = helpers.tmpname() +local tmpname = t.tmpname() -- o={ -- args=…, @@ -24,7 +24,7 @@ local function reset(o) elseif o.args then args = concat_tables(args, o.args) end - helpers.clear { + t.clear { args_rm = args_rm, args = args, } @@ -32,7 +32,7 @@ local function reset(o) end local clear = function() - helpers.expect_exit(helpers.command, 'qall!') + t.expect_exit(t.command, 'qall!') os.remove(tmpname) end diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua index d70f5deded..9c97d6a98f 100644 --- a/test/functional/shada/variables_spec.lua +++ b/test/functional/shada/variables_spec.lua @@ -1,11 +1,10 @@ -- ShaDa variables saving/reading support -local helpers = require('test.functional.helpers')(after_each) -local api, fn, nvim_command, eq, eval = - helpers.api, helpers.fn, helpers.command, helpers.eq, helpers.eval -local expect_exit = helpers.expect_exit +local t = require('test.functional.testutil')(after_each) +local api, fn, nvim_command, eq, eval = t.api, t.fn, t.command, t.eq, t.eval +local expect_exit = t.expect_exit -local shada_helpers = require('test.functional.shada.helpers') -local reset, clear = shada_helpers.reset, shada_helpers.clear +local t_shada = require('test.functional.shada.testutil') +local reset, clear = t_shada.reset, t_shada.clear describe('ShaDa support code', function() before_each(reset) diff --git a/test/functional/terminal/altscreen_spec.lua b/test/functional/terminal/altscreen_spec.lua index c3be9ec6ca..5b19ba0b65 100644 --- a/test/functional/terminal/altscreen_spec.lua +++ b/test/functional/terminal/altscreen_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local clear, eq, api = helpers.clear, helpers.eq, helpers.api -local feed = helpers.feed -local feed_data = thelpers.feed_data -local enter_altscreen = thelpers.enter_altscreen -local exit_altscreen = thelpers.exit_altscreen +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local clear, eq, api = t.clear, t.eq, t.api +local feed = t.feed +local feed_data = tt.feed_data +local enter_altscreen = tt.enter_altscreen +local exit_altscreen = tt.exit_altscreen -if helpers.skip(helpers.is_os('win')) then +if t.skip(t.is_os('win')) then return end @@ -15,7 +15,7 @@ describe(':terminal altscreen', function() before_each(function() clear() - screen = thelpers.screen_setup() + screen = tt.screen_setup() feed_data({ 'line1', 'line2', diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua index 79cc5016da..9d1b9f10a2 100644 --- a/test/functional/terminal/api_spec.lua +++ b/test/functional/terminal/api_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local child_session = require('test.functional.terminal.helpers') -local ok = helpers.ok +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local ok = t.ok -if helpers.skip(helpers.is_os('win')) then +if t.skip(t.is_os('win')) then return end @@ -11,9 +11,9 @@ describe('api', function() local socket_name = './Xtest_functional_api.sock' before_each(function() - helpers.clear() + t.clear() os.remove(socket_name) - screen = child_session.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -21,7 +21,7 @@ describe('api', function() '--cmd', 'colorscheme vim', '--cmd', - helpers.nvim_set .. ' notermguicolors', + t.nvim_set .. ' notermguicolors', }) end) after_each(function() @@ -39,7 +39,7 @@ describe('api', function() } -- Start the socket from the child nvim. - child_session.feed_data(":echo serverstart('" .. socket_name .. "')\n") + tt.feed_data(":echo serverstart('" .. socket_name .. "')\n") -- Wait for socket creation. screen:expect([[ @@ -49,10 +49,10 @@ describe('api', function() {3:-- TERMINAL --} | ]]) - local socket_session1 = helpers.connect(socket_name) - local socket_session2 = helpers.connect(socket_name) + local socket_session1 = t.connect(socket_name) + local socket_session2 = t.connect(socket_name) - child_session.feed_data('i[tui] insert-mode') + tt.feed_data('i[tui] insert-mode') -- Wait for stdin to be processed. screen:expect([[ [tui] insert-mode{1: } | diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 741aaf2fe0..10d6445bf4 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -1,25 +1,25 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local thelpers = require('test.functional.terminal.helpers') -local assert_alive = helpers.assert_alive -local feed, clear = helpers.feed, helpers.clear -local poke_eventloop = helpers.poke_eventloop -local nvim_prog = helpers.nvim_prog -local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source -local pcall_err = helpers.pcall_err -local eq, neq = helpers.eq, helpers.neq -local api = helpers.api -local retry = helpers.retry -local testprg = helpers.testprg -local write_file = helpers.write_file -local command = helpers.command -local exc_exec = helpers.exc_exec -local matches = helpers.matches -local exec_lua = helpers.exec_lua +local tt = require('test.functional.terminal.testutil') +local assert_alive = t.assert_alive +local feed, clear = t.feed, t.clear +local poke_eventloop = t.poke_eventloop +local nvim_prog = t.nvim_prog +local eval, feed_command, source = t.eval, t.feed_command, t.source +local pcall_err = t.pcall_err +local eq, neq = t.eq, t.neq +local api = t.api +local retry = t.retry +local testprg = t.testprg +local write_file = t.write_file +local command = t.command +local exc_exec = t.exc_exec +local matches = t.matches +local exec_lua = t.exec_lua local sleep = vim.uv.sleep -local fn = helpers.fn -local is_os = helpers.is_os -local skip = helpers.skip +local fn = t.fn +local is_os = t.is_os +local skip = t.skip describe(':terminal buffer', function() local screen @@ -27,7 +27,7 @@ describe(':terminal buffer', function() before_each(function() clear() command('set modifiable swapfile undolevels=20') - screen = thelpers.screen_setup() + screen = tt.screen_setup() end) it('terminal-mode forces various options', function() @@ -266,7 +266,7 @@ describe(':terminal buffer', function() it('does not segfault when pasting empty register #13955', function() feed('<c-\\><c-n>') feed_command('put a') -- register a is empty - helpers.assert_alive() + t.assert_alive() end) it([[can use temporary normal mode <c-\><c-o>]], function() @@ -473,7 +473,7 @@ end) describe('terminal input', function() it('sends various special keys with modifiers', function() clear() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -560,7 +560,7 @@ if is_os('win') then feed_command('set modifiable swapfile undolevels=20') poke_eventloop() local cmd = { 'cmd.exe', '/K', 'PROMPT=$g$s' } - screen = thelpers.screen_setup(nil, cmd) + screen = tt.screen_setup(nil, cmd) end) it('"put" operator sends data normally', function() diff --git a/test/functional/terminal/channel_spec.lua b/test/functional/terminal/channel_spec.lua index fd98c5d8f6..f8af320b27 100644 --- a/test/functional/terminal/channel_spec.lua +++ b/test/functional/terminal/channel_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local command = helpers.command -local pcall_err = helpers.pcall_err -local feed = helpers.feed -local poke_eventloop = helpers.poke_eventloop -local is_os = helpers.is_os -local api = helpers.api -local async_meths = helpers.async_meths -local testprg = helpers.testprg -local assert_alive = helpers.assert_alive +local clear = t.clear +local eq = t.eq +local eval = t.eval +local command = t.command +local pcall_err = t.pcall_err +local feed = t.feed +local poke_eventloop = t.poke_eventloop +local is_os = t.is_os +local api = t.api +local async_meths = t.async_meths +local testprg = t.testprg +local assert_alive = t.assert_alive describe('terminal channel is closed and later released if', function() local screen diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 9a56b4600b..f722965108 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -1,26 +1,26 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local thelpers = require('test.functional.terminal.helpers') -local feed, clear = helpers.feed, helpers.clear -local testprg, command = helpers.testprg, helpers.command -local eq, eval = helpers.eq, helpers.eval -local matches = helpers.matches -local poke_eventloop = helpers.poke_eventloop -local hide_cursor = thelpers.hide_cursor -local show_cursor = thelpers.show_cursor -local is_os = helpers.is_os -local skip = helpers.skip +local tt = require('test.functional.terminal.testutil') +local feed, clear = t.feed, t.clear +local testprg, command = t.testprg, t.command +local eq, eval = t.eq, t.eval +local matches = t.matches +local poke_eventloop = t.poke_eventloop +local hide_cursor = tt.hide_cursor +local show_cursor = tt.show_cursor +local is_os = t.is_os +local skip = t.skip describe(':terminal cursor', function() local screen before_each(function() clear() - screen = thelpers.screen_setup() + screen = tt.screen_setup() end) it('moves the screen cursor when focused', function() - thelpers.feed_data('testing cursor') + tt.feed_data('testing cursor') screen:expect([[ tty ready | testing cursor{1: } | @@ -66,7 +66,7 @@ describe(':terminal cursor', function() :set number | ]]) feed('i') - helpers.poke_eventloop() + t.poke_eventloop() screen:expect([[ {7: 1 }tty ready | {7: 2 }rows: 6, cols: 46 | @@ -152,7 +152,7 @@ describe('buffer cursor position is correct in terminal without number column', local screen local function setup_ex_register(str) - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -469,7 +469,7 @@ describe('buffer cursor position is correct in terminal with number column', fun local screen local function setup_ex_register(str) - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua index f7ceb0a68b..8642d3d988 100644 --- a/test/functional/terminal/edit_spec.lua +++ b/test/functional/terminal/edit_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local screen = require('test.functional.ui.screen') -local testprg = helpers.testprg -local command = helpers.command -local fn = helpers.fn -local api = helpers.api -local clear = helpers.clear -local eq = helpers.eq -local matches = helpers.matches +local testprg = t.testprg +local command = t.command +local fn = t.fn +local api = t.api +local clear = t.clear +local eq = t.eq +local matches = t.matches local pesc = vim.pesc describe(':edit term://*', function() diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 6f9db63b3a..d0cf65d69d 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -1,18 +1,18 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local clear, poke_eventloop = helpers.clear, helpers.poke_eventloop -local testprg, source, eq = helpers.testprg, helpers.source, helpers.eq -local feed = helpers.feed -local feed_command, eval = helpers.feed_command, helpers.eval -local fn = helpers.fn -local api = helpers.api -local retry = helpers.retry -local ok = helpers.ok -local command = helpers.command -local skip = helpers.skip -local is_os = helpers.is_os -local is_ci = helpers.is_ci +local assert_alive = t.assert_alive +local clear, poke_eventloop = t.clear, t.poke_eventloop +local testprg, source, eq = t.testprg, t.source, t.eq +local feed = t.feed +local feed_command, eval = t.feed_command, t.eval +local fn = t.fn +local api = t.api +local retry = t.retry +local ok = t.ok +local command = t.command +local skip = t.skip +local is_os = t.is_os +local is_ci = t.is_ci describe(':terminal', function() local screen diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 241c3e5a71..2c3ed4e97a 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local thelpers = require('test.functional.terminal.helpers') -local feed, clear = helpers.feed, helpers.clear -local api = helpers.api -local testprg, command = helpers.testprg, helpers.command -local nvim_prog_abs = helpers.nvim_prog_abs -local fn = helpers.fn -local nvim_set = helpers.nvim_set -local is_os = helpers.is_os -local skip = helpers.skip +local tt = require('test.functional.terminal.testutil') +local feed, clear = t.feed, t.clear +local api = t.api +local testprg, command = t.testprg, t.command +local nvim_prog_abs = t.nvim_prog_abs +local fn = t.fn +local nvim_set = t.nvim_set +local is_os = t.is_os +local skip = t.skip describe(':terminal highlight', function() local screen @@ -51,9 +51,9 @@ describe(':terminal highlight', function() describe(title, function() before_each(function() set_attrs_fn() - thelpers.feed_data('text') - thelpers.clear_attrs() - thelpers.feed_data('text') + tt.feed_data('text') + tt.clear_attrs() + tt.feed_data('text') end) local function pass_attrs() @@ -76,7 +76,7 @@ describe(':terminal highlight', function() table.insert(lines, 'line' .. tostring(i)) end table.insert(lines, '') - thelpers.feed_data(lines) + tt.feed_data(lines) screen:expect([[ line4 | line5 | @@ -101,28 +101,28 @@ describe(':terminal highlight', function() end descr('foreground', 1, function() - thelpers.set_fg(45) + tt.set_fg(45) end) descr('background', 2, function() - thelpers.set_bg(46) + tt.set_bg(46) end) descr('foreground and background', 3, function() - thelpers.set_fg(45) - thelpers.set_bg(46) + tt.set_fg(45) + tt.set_bg(46) end) descr('bold, italics, underline and strikethrough', 4, function() - thelpers.set_bold() - thelpers.set_italic() - thelpers.set_underline() - thelpers.set_strikethrough() + tt.set_bold() + tt.set_italic() + tt.set_underline() + tt.set_strikethrough() end) descr('bold and underdouble', 12, function() - thelpers.set_bold() - thelpers.set_underdouble() + tt.set_bold() + tt.set_underdouble() end) descr('italics and undercurl', 13, function() - thelpers.set_italic() - thelpers.set_undercurl() + tt.set_italic() + tt.set_undercurl() end) end) @@ -206,7 +206,7 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi ^tty ready | |*6 ]]) - thelpers.feed_data((' foobar'):rep(30)) + tt.feed_data((' foobar'):rep(30)) screen:expect([[ ^tty ready | foobar foobar foobar foobar foobar foobar foobar | @@ -319,12 +319,12 @@ describe(':terminal highlight forwarding', function() it('will handle cterm and rgb attributes', function() skip(is_os('win')) - thelpers.set_fg(3) - thelpers.feed_data('text') - thelpers.feed_termcode('[38:2:255:128:0m') - thelpers.feed_data('color') - thelpers.clear_attrs() - thelpers.feed_data('text') + tt.set_fg(3) + tt.feed_data('text') + tt.feed_termcode('[38:2:255:128:0m') + tt.feed_data('color') + tt.clear_attrs() + tt.feed_data('text') screen:expect { grid = [[ tty ready | @@ -366,10 +366,10 @@ describe(':terminal highlight with custom palette', function() it('will use the custom color', function() skip(is_os('win')) - thelpers.set_fg(3) - thelpers.feed_data('text') - thelpers.clear_attrs() - thelpers.feed_data('text') + tt.set_fg(3) + tt.feed_data('text') + tt.clear_attrs() + tt.feed_data('text') screen:expect([[ tty ready | {1:text}text{7: } | diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index 08ec7b97cf..326cee51ce 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval -local feed, api, command = helpers.feed, helpers.api, helpers.command -local feed_data = thelpers.feed_data -local is_os = helpers.is_os -local skip = helpers.skip +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local clear, eq, eval = t.clear, t.eq, t.eval +local feed, api, command = t.feed, t.api, t.command +local feed_data = tt.feed_data +local is_os = t.is_os +local skip = t.skip describe(':terminal mouse', function() local screen @@ -15,7 +15,7 @@ describe(':terminal mouse', function() command('highlight StatusLine cterm=NONE') command('highlight StatusLineNC cterm=NONE') command('highlight VertSplit cterm=NONE') - screen = thelpers.screen_setup() + screen = tt.screen_setup() local lines = {} for i = 1, 30 do table.insert(lines, 'line' .. tostring(i)) @@ -95,8 +95,8 @@ describe(':terminal mouse', function() describe('with mouse events enabled by the program', function() before_each(function() - thelpers.enable_mouse() - thelpers.feed_data('mouse enabled\n') + tt.enable_mouse() + tt.feed_data('mouse enabled\n') screen:expect([[ line27 | line28 | @@ -423,8 +423,8 @@ describe(':terminal mouse', function() ]]) -- enabling mouse won't affect interaction with other windows - thelpers.enable_mouse() - thelpers.feed_data('mouse enabled\n') + tt.enable_mouse() + tt.feed_data('mouse enabled\n') screen:expect([[ {7: 27 }line │line30 | {7: 28 }line │rows: 5, cols: 25 | diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index b8890ab581..ba135b827e 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -1,26 +1,26 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local clear, eq = helpers.clear, helpers.eq -local feed, testprg = helpers.feed, helpers.testprg -local eval = helpers.eval -local command = helpers.command -local poke_eventloop = helpers.poke_eventloop -local retry = helpers.retry -local api = helpers.api -local feed_data = thelpers.feed_data -local pcall_err = helpers.pcall_err -local exec_lua = helpers.exec_lua -local assert_alive = helpers.assert_alive -local skip = helpers.skip -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local clear, eq = t.clear, t.eq +local feed, testprg = t.feed, t.testprg +local eval = t.eval +local command = t.command +local poke_eventloop = t.poke_eventloop +local retry = t.retry +local api = t.api +local feed_data = tt.feed_data +local pcall_err = t.pcall_err +local exec_lua = t.exec_lua +local assert_alive = t.assert_alive +local skip = t.skip +local is_os = t.is_os describe(':terminal scrollback', function() local screen before_each(function() clear() - screen = thelpers.screen_setup(nil, nil, 30) + screen = tt.screen_setup(nil, nil, 30) end) describe('when the limit is exceeded', function() @@ -397,9 +397,9 @@ describe("'scrollback' option", function() it('set to 0 behaves as 1', function() local screen if is_os('win') then - screen = thelpers.screen_setup(nil, { 'cmd.exe' }, 30) + screen = tt.screen_setup(nil, { 'cmd.exe' }, 30) else - screen = thelpers.screen_setup(nil, { 'sh' }, 30) + screen = tt.screen_setup(nil, { 'sh' }, 30) end api.nvim_set_option_value('scrollback', 0, {}) @@ -414,10 +414,10 @@ describe("'scrollback' option", function() local screen if is_os('win') then command([[let $PROMPT='$$']]) - screen = thelpers.screen_setup(nil, { 'cmd.exe' }, 30) + screen = tt.screen_setup(nil, { 'cmd.exe' }, 30) else command('let $PS1 = "$"') - screen = thelpers.screen_setup(nil, { 'sh' }, 30) + screen = tt.screen_setup(nil, { 'sh' }, 30) end api.nvim_set_option_value('scrollback', 200, {}) @@ -479,7 +479,7 @@ describe("'scrollback' option", function() it('deletes extra lines immediately', function() -- Scrollback is 10 on screen_setup - local screen = thelpers.screen_setup(nil, nil, 30) + local screen = tt.screen_setup(nil, nil, 30) local lines = {} for i = 1, 30 do table.insert(lines, 'line' .. tostring(i)) diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/testutil.lua index 05db1b3c8c..878b3bf409 100644 --- a/test/functional/terminal/helpers.lua +++ b/test/functional/terminal/testutil.lua @@ -1,12 +1,12 @@ -- To test tui/input.c, this module spawns `nvim` inside :terminal and sends --- bytes via jobsend(). Note: the functional/helpers.lua test-session methods +-- bytes via jobsend(). Note: the functional/t.lua test-session methods -- operate on the _host_ session, _not_ the child session. -local helpers = require('test.functional.helpers')(nil) +local t = require('test.functional.testutil')(nil) local Screen = require('test.functional.ui.screen') -local testprg = helpers.testprg -local exec_lua = helpers.exec_lua -local api = helpers.api -local nvim_prog = helpers.nvim_prog +local testprg = t.testprg +local exec_lua = t.exec_lua +local api = t.api +local nvim_prog = t.nvim_prog local function feed_data(data) if type(data) == 'table' then @@ -30,7 +30,7 @@ local function make_lua_executor(session) end end --- some helpers for controlling the terminal. the codes were taken from +-- some t for controlling the terminal. the codes were taken from -- infocmp xterm-256color which is less what libvterm understands -- civis/cnorm local function hide_cursor() diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 007ae25b33..f172669a43 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -4,36 +4,36 @@ -- "bracketed paste" terminal feature: -- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local feed_data = thelpers.feed_data -local clear = helpers.clear -local command = helpers.command -local dedent = helpers.dedent -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local testprg = helpers.testprg -local retry = helpers.retry -local nvim_prog = helpers.nvim_prog -local nvim_set = helpers.nvim_set -local ok = helpers.ok -local read_file = helpers.read_file -local fn = helpers.fn -local api = helpers.api -local is_ci = helpers.is_ci -local is_os = helpers.is_os -local new_pipename = helpers.new_pipename -local spawn_argv = helpers.spawn_argv -local set_session = helpers.set_session -local write_file = helpers.write_file -local eval = helpers.eval -local assert_log = helpers.assert_log +local eq = t.eq +local feed_data = tt.feed_data +local clear = t.clear +local command = t.command +local dedent = t.dedent +local exec = t.exec +local exec_lua = t.exec_lua +local testprg = t.testprg +local retry = t.retry +local nvim_prog = t.nvim_prog +local nvim_set = t.nvim_set +local ok = t.ok +local read_file = t.read_file +local fn = t.fn +local api = t.api +local is_ci = t.is_ci +local is_os = t.is_os +local new_pipename = t.new_pipename +local spawn_argv = t.spawn_argv +local set_session = t.set_session +local write_file = t.write_file +local eval = t.eval +local assert_log = t.assert_log local testlog = 'Xtest-tui-log' -if helpers.skip(is_os('win')) then +if t.skip(is_os('win')) then return end @@ -45,7 +45,7 @@ describe('TUI', function() before_each(function() clear() local child_server = new_pipename() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '--listen', child_server, '-u', @@ -64,8 +64,8 @@ describe('TUI', function() | {3:-- TERMINAL --} | ]]) - child_session = helpers.connect(child_server) - child_exec_lua = thelpers.make_lua_executor(child_session) + child_session = t.connect(child_server) + child_exec_lua = tt.make_lua_executor(child_session) end) -- Wait for mode in the child Nvim (avoid "typeahead race" #10826). @@ -1347,15 +1347,15 @@ describe('TUI', function() it('paste: big burst of input', function() feed_data(':set ruler\n') - local t = {} + local q = {} for i = 1, 3000 do - t[i] = 'item ' .. tostring(i) + q[i] = 'item ' .. tostring(i) end feed_data('i') wait_for_mode('i') -- "bracketed paste" - feed_data('\027[200~' .. table.concat(t, '\n') .. '\027[201~') - expect_child_buf_lines(t) + feed_data('\027[200~' .. table.concat(q, '\n') .. '\027[201~') + expect_child_buf_lines(q) feed_data(' end') screen:expect([[ item 2997 | @@ -1695,7 +1695,7 @@ describe('TUI', function() end) it('draws correctly when cursor_address overflows #21643', function() - helpers.skip(is_os('mac'), 'FIXME: crashes/errors on macOS') + t.skip(is_os('mac'), 'FIXME: crashes/errors on macOS') screen:try_resize(77, 855) retry(nil, nil, function() eq({ true, 852 }, { child_session:request('nvim_win_get_height', 0) }) @@ -1973,7 +1973,7 @@ describe('TUI', function() finally(function() os.remove(script_file) end) - local screen = thelpers.setup_child_nvim({ '--clean', '-l', script_file }) + local screen = tt.setup_child_nvim({ '--clean', '-l', script_file }) screen:expect { grid = [[ {1: } | @@ -2001,7 +2001,7 @@ describe('TUI', function() finally(function() os.remove('testF') end) - local screen = thelpers.screen_setup( + local screen = tt.screen_setup( 0, ('"%s" -u NONE -i NONE --cmd "set noswapfile noshowcmd noruler" --cmd "normal iabc" > /dev/null 2>&1 && cat testF && rm testF'):format( nvim_prog @@ -2022,7 +2022,7 @@ describe('TUI', function() end) it('<C-h> #10134', function() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2055,7 +2055,7 @@ describe('TUI', function() end) it('draws line with many trailing spaces correctly #24955', function() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2094,7 +2094,7 @@ describe('TUI', function() it('no heap-buffer-overflow when changing &columns', function() -- Set a different bg colour and change $TERM to something dumber so the `print_spaces()` -- codepath in `clear_region()` is hit. - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2137,7 +2137,7 @@ end) describe('TUI UIEnter/UILeave', function() it('fires exactly once, after VimEnter', function() clear() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2184,7 +2184,7 @@ describe('TUI FocusGained/FocusLost', function() before_each(function() clear() local child_server = new_pipename() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '--listen', child_server, '-u', @@ -2204,7 +2204,7 @@ describe('TUI FocusGained/FocusLost', function() | {3:-- TERMINAL --} | ]]) - child_session = helpers.connect(child_server) + child_session = t.connect(child_server) child_session:request( 'nvim_exec2', [[ @@ -2396,14 +2396,14 @@ describe('TUI FocusGained/FocusLost', function() end) end) --- These tests require `thelpers` because --headless/--embed +-- These tests require `tt` because --headless/--embed -- does not initialize the TUI. describe("TUI 't_Co' (terminal colors)", function() local screen local function assert_term_colors(term, colorterm, maxcolors) clear({ env = { TERM = term }, args = {} }) - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2679,14 +2679,14 @@ describe("TUI 't_Co' (terminal colors)", function() end) end) --- These tests require `thelpers` because --headless/--embed +-- These tests require `tt` because --headless/--embed -- does not initialize the TUI. describe("TUI 'term' option", function() local screen local function assert_term(term_envvar, term_expected) clear() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2734,7 +2734,7 @@ describe("TUI 'term' option", function() end) end) --- These tests require `thelpers` because --headless/--embed +-- These tests require `tt` because --headless/--embed -- does not initialize the TUI. describe('TUI', function() local screen @@ -2746,7 +2746,7 @@ describe('TUI', function() -- Runs (child) `nvim` in a TTY (:terminal), to start the builtin TUI. local function nvim_tui(extra_args) clear() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2827,7 +2827,7 @@ describe('TUI', function() ]]) local child_server = new_pipename() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '--listen', child_server, '-u', @@ -2847,7 +2847,7 @@ describe('TUI', function() screen:expect({ any = '%[No Name%]' }) - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) retry(nil, 1000, function() eq({ Tc = true, @@ -2877,7 +2877,7 @@ describe('TUI', function() ]]) local child_server = new_pipename() - screen = thelpers.setup_child_nvim({ + screen = tt.setup_child_nvim({ '--listen', child_server, -- Use --clean instead of -u NONE to load the osc52 plugin @@ -2893,7 +2893,7 @@ describe('TUI', function() screen:expect({ any = '%[No Name%]' }) - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) retry(nil, 1000, function() eq('Ms', eval("get(g:, 'xtgettcap', '')")) eq({ true, 'OSC 52' }, { child_session:request('nvim_eval', 'g:clipboard.name') }) @@ -2908,7 +2908,7 @@ describe('TUI bg color', function() command('highlight clear Normal') command('set background=dark') -- set outer Nvim background local child_server = new_pipename() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '--listen', child_server, '-u', @@ -2921,7 +2921,7 @@ describe('TUI bg color', function() 'set noswapfile', }) screen:expect({ any = '%[No Name%]' }) - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) retry(nil, nil, function() eq({ true, 'dark' }, { child_session:request('nvim_eval', '&background') }) end) @@ -2931,7 +2931,7 @@ describe('TUI bg color', function() command('highlight clear Normal') command('set background=light') -- set outer Nvim background local child_server = new_pipename() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '--listen', child_server, '-u', @@ -2944,7 +2944,7 @@ describe('TUI bg color', function() 'set noswapfile', }) screen:expect({ any = '%[No Name%]' }) - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) retry(nil, nil, function() eq({ true, 'light' }, { child_session:request('nvim_eval', '&background') }) end) @@ -2962,7 +2962,7 @@ describe('TUI bg color', function() end, }) ]]) - thelpers.setup_child_nvim({ + tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -2978,7 +2978,7 @@ describe('TUI bg color', function() end) it('triggers OptionSet from automatic background processing', function() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -3000,7 +3000,7 @@ describe('TUI bg color', function() end) end) --- These tests require `thelpers` because --headless/--embed +-- These tests require `tt` because --headless/--embed -- does not initialize the TUI. describe('TUI as a client', function() after_each(function() @@ -3013,7 +3013,7 @@ describe('TUI as a client', function() set_session(server_super) local server_pipe = new_pipename() - local screen_server = thelpers.setup_child_nvim({ + local screen_server = tt.setup_child_nvim({ '--listen', server_pipe, '-u', @@ -3048,7 +3048,7 @@ describe('TUI as a client', function() } set_session(client_super) - local screen_client = thelpers.setup_child_nvim({ + local screen_client = tt.setup_child_nvim({ '--server', server_pipe, '--remote-ui', @@ -3092,7 +3092,7 @@ describe('TUI as a client', function() server:request('nvim_command', 'set notermguicolors') set_session(client_super) - local screen_client = thelpers.setup_child_nvim({ + local screen_client = tt.setup_child_nvim({ '--server', server_pipe, '--remote-ui', @@ -3134,7 +3134,7 @@ describe('TUI as a client', function() it('throws error when no server exists', function() clear() - local screen = thelpers.setup_child_nvim({ + local screen = tt.setup_child_nvim({ '--server', '127.0.0.1:2436546', '--remote-ui', @@ -3155,7 +3155,7 @@ describe('TUI as a client', function() set_session(server_super) local server_pipe = new_pipename() - local screen_server = thelpers.setup_child_nvim({ + local screen_server = tt.setup_child_nvim({ '--listen', server_pipe, '-u', @@ -3199,7 +3199,7 @@ describe('TUI as a client', function() } set_session(client_super) - local screen_client = thelpers.setup_child_nvim({ + local screen_client = tt.setup_child_nvim({ '--server', server_pipe, '--remote-ui', diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index b63e61d9e7..1ae240829a 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -1,21 +1,21 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local feed_data = thelpers.feed_data -local feed, clear = helpers.feed, helpers.clear -local poke_eventloop = helpers.poke_eventloop -local command = helpers.command -local retry = helpers.retry -local eq = helpers.eq -local eval = helpers.eval -local skip = helpers.skip -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local feed_data = tt.feed_data +local feed, clear = t.feed, t.clear +local poke_eventloop = t.poke_eventloop +local command = t.command +local retry = t.retry +local eq = t.eq +local eval = t.eval +local skip = t.skip +local is_os = t.is_os describe(':terminal window', function() local screen before_each(function() clear() - screen = thelpers.screen_setup() + screen = tt.screen_setup() end) it('sets topline correctly #8556', function() @@ -176,7 +176,7 @@ describe(':terminal with multigrid', function() before_each(function() clear() - screen = thelpers.screen_setup(0, nil, 50, nil, { ext_multigrid = true }) + screen = tt.screen_setup(0, nil, 50, nil, { ext_multigrid = true }) end) it('resizes to requested size', function() diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua index 17411e2724..a646aaf090 100644 --- a/test/functional/terminal/window_split_tab_spec.lua +++ b/test/functional/terminal/window_split_tab_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local feed = helpers.feed -local feed_command = helpers.feed_command -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') +local assert_alive = t.assert_alive +local clear = t.clear +local feed = t.feed +local feed_command = t.feed_command +local command = t.command +local eq = t.eq +local eval = t.eval +local api = t.api local sleep = vim.uv.sleep -local retry = helpers.retry -local is_os = helpers.is_os +local retry = t.retry +local is_os = t.is_os describe(':terminal', function() local screen @@ -23,7 +23,7 @@ describe(':terminal', function() command('highlight StatusLine cterm=NONE') command('highlight StatusLineNC cterm=NONE') command('highlight VertSplit cterm=NONE') - screen = thelpers.screen_setup(3) + screen = tt.screen_setup(3) end) after_each(function() diff --git a/test/functional/helpers.lua b/test/functional/testutil.lua index e5b0819d12..e6d89eb302 100644 --- a/test/functional/helpers.lua +++ b/test/functional/testutil.lua @@ -1,25 +1,25 @@ local uv = vim.uv -local global_helpers = require('test.helpers') +local t_global = require('test.testutil') local Session = require('test.client.session') local uv_stream = require('test.client.uv_stream') local SocketStream = uv_stream.SocketStream local ChildProcessStream = uv_stream.ChildProcessStream -local check_cores = global_helpers.check_cores -local check_logs = global_helpers.check_logs -local dedent = global_helpers.dedent -local eq = global_helpers.eq -local is_os = global_helpers.is_os -local ok = global_helpers.ok +local check_cores = t_global.check_cores +local check_logs = t_global.check_logs +local dedent = t_global.dedent +local eq = t_global.eq +local is_os = t_global.is_os +local ok = t_global.ok local sleep = uv.sleep -local fail = global_helpers.fail +local fail = t_global.fail ---- @class test.functional.helpers: test.helpers -local module = vim.deepcopy(global_helpers) +--- @class test.functional.testutil: test.testutil +local module = vim.deepcopy(t_global) local runtime_set = 'set runtimepath^=./build/lib/nvim/' -module.nvim_prog = (os.getenv('NVIM_PRG') or global_helpers.paths.test_build_dir .. '/bin/nvim') +module.nvim_prog = (os.getenv('NVIM_PRG') or t_global.paths.test_build_dir .. '/bin/nvim') -- Default settings for the test session. module.nvim_set = ( 'set shortmess+=IS background=light termguicolors noswapfile noautoindent startofline' @@ -790,7 +790,7 @@ local function do_rmdir(path) for file in vim.fs.dir(path) do if file ~= '.' and file ~= '..' then local abspath = path .. '/' .. file - if global_helpers.isdir(abspath) then + if t_global.isdir(abspath) then do_rmdir(abspath) -- recurse else local ret, err = os.remove(abspath) @@ -965,7 +965,7 @@ function module.alter_slashes(obj) end local load_factor = 1 -if global_helpers.is_ci() then +if t_global.is_ci() then -- Compute load factor only once (but outside of any tests). module.clear() module.request('nvim_command', 'source test/old/testdir/load.vim') @@ -1022,7 +1022,7 @@ function module.mkdir_p(path) return os.execute((is_os('win') and 'mkdir ' .. path or 'mkdir -p ' .. path)) end ---- @return test.functional.helpers +--- @return test.functional.testutil return function(after_each) if after_each then after_each(function() diff --git a/test/functional/treesitter/fold_spec.lua b/test/functional/treesitter/fold_spec.lua index 9428432f66..b7bae0d17e 100644 --- a/test/functional/treesitter/fold_spec.lua +++ b/test/functional/treesitter/fold_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local insert = helpers.insert -local exec_lua = helpers.exec_lua -local command = helpers.command -local feed = helpers.feed -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local insert = t.insert +local exec_lua = t.exec_lua +local command = t.command +local feed = t.feed +local poke_eventloop = t.poke_eventloop local Screen = require('test.functional.ui.screen') before_each(clear) diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 5d61524791..09f0c0bfcb 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local insert = helpers.insert -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local command = helpers.command -local api = helpers.api -local eq = helpers.eq +local clear = t.clear +local insert = t.insert +local exec_lua = t.exec_lua +local feed = t.feed +local command = t.command +local api = t.api +local eq = t.eq before_each(clear) @@ -872,7 +872,7 @@ describe('treesitter highlighting (help)', function() ]], } - helpers.api.nvim_buf_set_text(0, 0, 1, 0, 5, { 'lua' }) + t.api.nvim_buf_set_text(0, 0, 1, 0, 5, { 'lua' }) screen:expect { grid = [[ @@ -885,7 +885,7 @@ describe('treesitter highlighting (help)', function() ]], } - helpers.api.nvim_buf_set_text(0, 0, 1, 0, 4, { 'ruby' }) + t.api.nvim_buf_set_text(0, 0, 1, 0, 4, { 'ruby' }) screen:expect { grid = [[ diff --git a/test/functional/treesitter/inspect_tree_spec.lua b/test/functional/treesitter/inspect_tree_spec.lua index a3d44ff906..21b8123378 100644 --- a/test/functional/treesitter/inspect_tree_spec.lua +++ b/test/functional/treesitter/inspect_tree_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local insert = helpers.insert -local dedent = helpers.dedent -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local insert = t.insert +local dedent = t.dedent +local eq = t.eq +local exec_lua = t.exec_lua +local feed = t.feed describe('vim.treesitter.inspect_tree', function() before_each(clear) local expect_tree = function(x) local expected = vim.split(vim.trim(dedent(x)), '\n') - local actual = helpers.buf_lines(0) ---@type string[] + local actual = t.buf_lines(0) ---@type string[] eq(expected, actual) end diff --git a/test/functional/treesitter/language_spec.lua b/test/functional/treesitter/language_spec.lua index 65d9e0e81c..4473fa0265 100644 --- a/test/functional/treesitter/language_spec.lua +++ b/test/functional/treesitter/language_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local eq = helpers.eq -local command = helpers.command -local exec_lua = helpers.exec_lua -local pcall_err = helpers.pcall_err -local matches = helpers.matches -local insert = helpers.insert +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local eq = t.eq +local command = t.command +local exec_lua = t.exec_lua +local pcall_err = t.pcall_err +local matches = t.matches +local insert = t.insert before_each(clear) diff --git a/test/functional/treesitter/node_spec.lua b/test/functional/treesitter/node_spec.lua index f114d36823..7c5c09e7ef 100644 --- a/test/functional/treesitter/node_spec.lua +++ b/test/functional/treesitter/node_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local insert = helpers.insert -local assert_alive = helpers.assert_alive +local clear = t.clear +local eq = t.eq +local exec_lua = t.exec_lua +local insert = t.insert +local assert_alive = t.assert_alive before_each(clear) diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua index 5af53202a6..8b2d1fd4aa 100644 --- a/test/functional/treesitter/parser_spec.lua +++ b/test/functional/treesitter/parser_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local dedent = helpers.dedent -local eq = helpers.eq -local insert = helpers.insert -local exec_lua = helpers.exec_lua -local pcall_err = helpers.pcall_err -local feed = helpers.feed +local clear = t.clear +local dedent = t.dedent +local eq = t.eq +local insert = t.insert +local exec_lua = t.exec_lua +local pcall_err = t.pcall_err +local feed = t.feed describe('treesitter parser API', function() before_each(function() @@ -381,7 +381,7 @@ int x = INT_MAX; { 2, 29, 2, 66 }, -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y)) }, get_ranges()) - helpers.feed('ggo<esc>') + t.feed('ggo<esc>') eq(5, exec_lua('return #parser:children().c:trees()')) eq({ { 0, 0, 8, 0 }, -- root tree @@ -418,7 +418,7 @@ int x = INT_MAX; -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y)) }, get_ranges()) - helpers.feed('ggo<esc>') + t.feed('ggo<esc>') eq('table', exec_lua('return type(parser:children().c)')) eq(2, exec_lua('return #parser:children().c:trees()')) eq({ @@ -430,7 +430,7 @@ int x = INT_MAX; -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y)) }, get_ranges()) - helpers.feed('7ggI//<esc>') + t.feed('7ggI//<esc>') exec_lua([[parser:parse({6, 7})]]) eq('table', exec_lua('return type(parser:children().c)')) eq(2, exec_lua('return #parser:children().c:trees()')) @@ -468,7 +468,7 @@ int x = INT_MAX; { 2, 29, 2, 66 }, -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y)) }, get_ranges()) - helpers.feed('ggo<esc>') + t.feed('ggo<esc>') eq(5, exec_lua('return #parser:children().c:trees()')) eq({ { 0, 0, 8, 0 }, -- root tree @@ -657,7 +657,7 @@ int x = INT_MAX; { 'declaration', 1, 2, 1, 12 }, }, run_query()) - helpers.command 'normal ggO' + t.command 'normal ggO' insert('int a;') eq({ diff --git a/test/functional/treesitter/query_spec.lua b/test/functional/treesitter/query_spec.lua index 170f448f97..0dd66fdba5 100644 --- a/test/functional/treesitter/query_spec.lua +++ b/test/functional/treesitter/query_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local dedent = helpers.dedent -local eq = helpers.eq -local insert = helpers.insert -local exec_lua = helpers.exec_lua -local pcall_err = helpers.pcall_err -local is_os = helpers.is_os -local api = helpers.api -local fn = helpers.fn +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local dedent = t.dedent +local eq = t.eq +local insert = t.insert +local exec_lua = t.exec_lua +local pcall_err = t.pcall_err +local is_os = t.is_os +local api = t.api +local fn = t.fn describe('treesitter query API', function() before_each(function() diff --git a/test/functional/treesitter/utils_spec.lua b/test/functional/treesitter/utils_spec.lua index 2734c22499..c45d3ca047 100644 --- a/test/functional/treesitter/utils_spec.lua +++ b/test/functional/treesitter/utils_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local insert = helpers.insert -local eq = helpers.eq -local exec_lua = helpers.exec_lua +local clear = t.clear +local insert = t.insert +local eq = t.eq +local exec_lua = t.exec_lua before_each(clear) diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua index 896f75a681..e7f159437b 100644 --- a/test/functional/ui/bufhl_spec.lua +++ b/test/functional/ui/bufhl_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, neq = helpers.command, helpers.neq -local api = helpers.api -local eq = helpers.eq -local pcall_err = helpers.pcall_err +local clear, feed, insert = t.clear, t.feed, t.insert +local command, neq = t.command, t.neq +local api = t.api +local eq = t.eq +local pcall_err = t.pcall_err local set_virtual_text = api.nvim_buf_set_virtual_text describe('Buffer highlighting', function() diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 6c4000ba41..00c75c375f 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local feed = helpers.feed -local clear = helpers.clear -local api = helpers.api -local fn = helpers.fn -local source = helpers.source -local exec_capture = helpers.exec_capture -local dedent = helpers.dedent -local command = helpers.command +local eq = t.eq +local feed = t.feed +local clear = t.clear +local api = t.api +local fn = t.fn +local source = t.source +local exec_capture = t.exec_capture +local dedent = t.dedent +local command = t.command local screen diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 0b2c0af66b..a3d44f3542 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed = helpers.clear, helpers.feed -local source = helpers.source -local command = helpers.command -local assert_alive = helpers.assert_alive -local poke_eventloop = helpers.poke_eventloop -local exec = helpers.exec -local eval = helpers.eval -local eq = helpers.eq -local is_os = helpers.is_os -local api = helpers.api +local clear, feed = t.clear, t.feed +local source = t.source +local command = t.command +local assert_alive = t.assert_alive +local poke_eventloop = t.poke_eventloop +local exec = t.exec +local eval = t.eval +local eq = t.eq +local is_os = t.is_os +local api = t.api local function new_screen(opt) local screen = Screen.new(25, 5) diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua index cf6e342dcf..d4c23d45e2 100644 --- a/test/functional/ui/cursor_spec.lua +++ b/test/functional/ui/cursor_spec.lua @@ -1,8 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, api = helpers.clear, helpers.api -local eq = helpers.eq -local command = helpers.command +local clear, api = t.clear, t.api +local eq = t.eq +local command = t.command describe('ui/cursor', function() local screen @@ -213,8 +213,8 @@ describe('ui/cursor', function() } -- Change the cursor style. - helpers.command('hi Cursor guibg=DarkGray') - helpers.command( + t.command('hi Cursor guibg=DarkGray') + t.command( 'set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr-o:hor20' .. ',a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor' .. ',sm:block-blinkwait175-blinkoff150-blinkon175' @@ -260,8 +260,8 @@ describe('ui/cursor', function() end) -- Change hl groups only, should update the styles - helpers.command('hi Cursor guibg=Red') - helpers.command('hi lCursor guibg=Green') + t.command('hi Cursor guibg=Red') + t.command('hi lCursor guibg=Green') -- Update the expected values. for _, m in ipairs(expected_mode_info) do @@ -280,7 +280,7 @@ describe('ui/cursor', function() end) -- update the highlight again to hide cursor - helpers.command('hi Cursor blend=100') + t.command('hi Cursor blend=100') for _, m in ipairs(expected_mode_info) do if m.hl_id then diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 0fdbf5c6b1..924e4107db 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -1,18 +1,18 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local feed = helpers.feed -local insert = helpers.insert -local exec_lua = helpers.exec_lua -local exec = helpers.exec -local expect_events = helpers.expect_events -local api = helpers.api -local fn = helpers.fn -local command = helpers.command -local eq = helpers.eq -local assert_alive = helpers.assert_alive -local pcall_err = helpers.pcall_err +local clear = t.clear +local feed = t.feed +local insert = t.insert +local exec_lua = t.exec_lua +local exec = t.exec +local expect_events = t.expect_events +local api = t.api +local fn = t.fn +local command = t.command +local eq = t.eq +local assert_alive = t.assert_alive +local pcall_err = t.pcall_err describe('decorations providers', function() local screen @@ -696,7 +696,7 @@ describe('decorations providers', function() end ]] - helpers.assert_alive() + t.assert_alive() end) it('supports subpriorities (order of definitions in a query file #27131)', function() @@ -2411,7 +2411,7 @@ describe('extmark decorations', function() | ]]} - helpers.assert_alive() + t.assert_alive() end) it('priority ordering of overlay or win_col virtual text at same position', function() @@ -5044,8 +5044,8 @@ l5 insert(example_test3) feed 'gg' - helpers.command('sign define Oldsign text=x') - helpers.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) + t.command('sign define Oldsign text=x') + t.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) @@ -5068,8 +5068,8 @@ l5 insert(example_test3) feed 'gg' - helpers.command('sign define Oldsign text=x') - helpers.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) + t.command('sign define Oldsign text=x') + t.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index e0dfde35f2..7aab061dc3 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed = helpers.feed -local clear = helpers.clear -local command = helpers.command -local insert = helpers.insert -local write_file = helpers.write_file -local dedent = helpers.dedent -local exec = helpers.exec -local eq = helpers.eq -local api = helpers.api +local feed = t.feed +local clear = t.clear +local command = t.command +local insert = t.insert +local write_file = t.write_file +local dedent = t.dedent +local exec = t.exec +local eq = t.eq +local api = t.api before_each(clear) diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index 5a8d6e1f62..49c808b5e6 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -1,21 +1,21 @@ local uv = vim.uv -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local api = helpers.api -local feed = helpers.feed -local eq = helpers.eq -local neq = helpers.neq -local clear = helpers.clear -local ok = helpers.ok -local fn = helpers.fn -local nvim_prog = helpers.nvim_prog -local retry = helpers.retry -local write_file = helpers.write_file -local assert_log = helpers.assert_log -local check_close = helpers.check_close -local is_os = helpers.is_os +local api = t.api +local feed = t.feed +local eq = t.eq +local neq = t.neq +local clear = t.clear +local ok = t.ok +local fn = t.fn +local nvim_prog = t.nvim_prog +local retry = t.retry +local write_file = t.write_file +local assert_log = t.assert_log +local check_close = t.check_close +local is_os = t.is_os local testlog = 'Xtest-embed-log' @@ -58,7 +58,7 @@ local function test_embed(ext_linegrid) end) it("doesn't erase output when setting color scheme", function() - if helpers.is_os('openbsd') then + if t.is_os('openbsd') then pending('FIXME #10804') end startup('--cmd', 'echoerr "foo"', '--cmd', 'color default', '--cmd', 'echoerr "bar"') @@ -143,7 +143,7 @@ describe('--embed UI', function() ]] if not is_os('win') then - assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog) + assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog, 100) end end) @@ -233,7 +233,7 @@ describe('--embed UI', function() } eq({ [16777215] = true }, seen) - -- NB: by accident how functional/helpers.lua currently handles the default color scheme, the + -- NB: by accident how functional/t.lua currently handles the default color scheme, the -- above is sufficient to test the behavior. But in case that workaround is removed, we need -- a test with an explicit override like below, so do it to remain safe. startup('--cmd', 'hi NORMAL guibg=#FF00FF') @@ -253,44 +253,44 @@ describe('--embed UI', function() screen:expect { condition = function() - eq(helpers.paths.test_source_path, screen.pwd) + eq(t.paths.test_source_path, screen.pwd) end, } -- Change global cwd - helpers.command(string.format('cd %s/src/nvim', helpers.paths.test_source_path)) + t.command(string.format('cd %s/src/nvim', t.paths.test_source_path)) screen:expect { condition = function() - eq(string.format('%s/src/nvim', helpers.paths.test_source_path), screen.pwd) + eq(string.format('%s/src/nvim', t.paths.test_source_path), screen.pwd) end, } -- Split the window and change the cwd in the split - helpers.command('new') - helpers.command(string.format('lcd %s/test', helpers.paths.test_source_path)) + t.command('new') + t.command(string.format('lcd %s/test', t.paths.test_source_path)) screen:expect { condition = function() - eq(string.format('%s/test', helpers.paths.test_source_path), screen.pwd) + eq(string.format('%s/test', t.paths.test_source_path), screen.pwd) end, } -- Move to the original window - helpers.command('wincmd p') + t.command('wincmd p') screen:expect { condition = function() - eq(string.format('%s/src/nvim', helpers.paths.test_source_path), screen.pwd) + eq(string.format('%s/src/nvim', t.paths.test_source_path), screen.pwd) end, } -- Change global cwd again - helpers.command(string.format('cd %s', helpers.paths.test_source_path)) + t.command(string.format('cd %s', t.paths.test_source_path)) screen:expect { condition = function() - eq(helpers.paths.test_source_path, screen.pwd) + eq(t.paths.test_source_path, screen.pwd) end, } end) @@ -298,9 +298,9 @@ end) describe('--embed --listen UI', function() it('waits for connection on listening address', function() - helpers.skip(helpers.is_os('win')) + t.skip(t.is_os('win')) clear() - local child_server = assert(helpers.new_pipename()) + local child_server = assert(t.new_pipename()) fn.jobstart({ nvim_prog, '--embed', @@ -314,7 +314,7 @@ describe('--embed --listen UI', function() neq(nil, uv.fs_stat(child_server)) end) - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) local info_ok, api_info = child_session:request('nvim_get_api_info') ok(info_ok) diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index e83f3ff57e..79e62d487f 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1,24 +1,24 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') local os = require('os') -local clear, feed = helpers.clear, helpers.feed -local assert_alive = helpers.assert_alive -local command, feed_command = helpers.command, helpers.feed_command -local eval = helpers.eval -local eq = helpers.eq -local neq = helpers.neq -local expect = helpers.expect -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local insert = helpers.insert -local api = helpers.api -local fn = helpers.fn -local run = helpers.run -local pcall_err = helpers.pcall_err +local clear, feed = t.clear, t.feed +local assert_alive = t.assert_alive +local command, feed_command = t.command, t.feed_command +local eval = t.eval +local eq = t.eq +local neq = t.neq +local expect = t.expect +local exec = t.exec +local exec_lua = t.exec_lua +local insert = t.insert +local api = t.api +local fn = t.fn +local run = t.run +local pcall_err = t.pcall_err local tbl_contains = vim.tbl_contains -local curbuf = helpers.api.nvim_get_current_buf -local curwin = helpers.api.nvim_get_current_win -local curtab = helpers.api.nvim_get_current_tabpage +local curbuf = t.api.nvim_get_current_buf +local curwin = t.api.nvim_get_current_win +local curtab = t.api.nvim_get_current_tabpage local NIL = vim.NIL describe('float window', function() @@ -4080,7 +4080,7 @@ describe('float window', function() if multigrid then pending("supports second UI without multigrid", function() - local session2 = helpers.connect(eval('v:servername')) + local session2 = t.connect(eval('v:servername')) print(session2:request("nvim_eval", "2+2")) local screen2 = Screen.new(40,7) screen2:attach(nil, session2) @@ -7978,7 +7978,7 @@ describe('float window', function() end) it("correctly redraws when overlaid windows are resized #13991", function() - helpers.source([[ + t.source([[ let popup_config = {"relative" : "editor", \ "width" : 7, \ "height" : 3, @@ -8042,7 +8042,7 @@ describe('float window', function() ]]) end - helpers.source([[ + t.source([[ let new_popup_config = {"width" : 1, "height" : 3} let new_border_config = {"width" : 3, "height" : 5} @@ -8057,7 +8057,7 @@ describe('float window', function() nnoremap zz <cmd>call Resize()<cr> ]]) - helpers.feed("zz") + t.feed("zz") if multigrid then screen:expect{grid=[[ ## grid 1 diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 7f13b6bd03..6bf019746d 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq -local command = helpers.command -local feed_command = helpers.feed_command -local insert = helpers.insert -local fn = helpers.fn -local api = helpers.api -local exec = helpers.exec -local assert_alive = helpers.assert_alive +local clear, feed, eq = t.clear, t.feed, t.eq +local command = t.command +local feed_command = t.feed_command +local insert = t.insert +local fn = t.fn +local api = t.api +local exec = t.exec +local assert_alive = t.assert_alive local content1 = [[ This is a diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 57d0f2f590..c6f1a680e6 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') local os = require('os') -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, exec = helpers.command, helpers.exec -local eval = helpers.eval -local feed_command, eq = helpers.feed_command, helpers.eq -local fn = helpers.fn -local api = helpers.api -local exec_lua = helpers.exec_lua +local clear, feed, insert = t.clear, t.feed, t.insert +local command, exec = t.command, t.exec +local eval = t.eval +local feed_command, eq = t.feed_command, t.eq +local fn = t.fn +local api = t.api +local exec_lua = t.exec_lua describe('colorscheme compatibility', function() before_each(function() @@ -2196,7 +2196,7 @@ describe("'winhighlight' highlight", function() ]], } - helpers.assert_alive() + t.assert_alive() end) it('can redraw statusline on cursor movement', function() diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua index 8b36ad5431..bc380ecf91 100644 --- a/test/functional/ui/hlstate_spec.lua +++ b/test/functional/ui/hlstate_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, insert = helpers.clear, helpers.insert -local command = helpers.command -local api = helpers.api -local testprg = helpers.testprg -local thelpers = require('test.functional.terminal.helpers') -local skip = helpers.skip -local is_os = helpers.is_os +local clear, insert = t.clear, t.insert +local command = t.command +local api = t.api +local testprg = t.testprg +local tt = require('test.functional.terminal.testutil') +local skip = t.skip +local is_os = t.is_os describe('ext_hlstate detailed highlights', function() local screen @@ -236,11 +236,11 @@ describe('ext_hlstate detailed highlights', function() {7: }| ]]) - thelpers.feed_data('x ') - thelpers.set_fg(45) - thelpers.feed_data('y ') - thelpers.set_bold() - thelpers.feed_data('z\n') + tt.feed_data('x ') + tt.set_fg(45) + tt.feed_data('y ') + tt.set_bold() + tt.feed_data('z\n') -- TODO(bfredl): check if this distinction makes sense if is_os('win') then screen:expect([[ @@ -260,8 +260,8 @@ describe('ext_hlstate detailed highlights', function() ]]) end - thelpers.feed_termcode('[A') - thelpers.feed_termcode('[2C') + tt.feed_termcode('[A') + tt.feed_termcode('[2C') if is_os('win') then screen:expect([[ ^tty ready | @@ -381,7 +381,7 @@ describe('ext_hlstate detailed highlights', function() }, } - helpers.feed('3ggV2jd') + t.feed('3ggV2jd') --screen:redraw_debug() screen:expect { grid = [[ @@ -478,7 +478,7 @@ describe('ext_hlstate detailed highlights', function() }, } - helpers.feed('3ggV2jd') + t.feed('3ggV2jd') --screen:redraw_debug() screen:expect { grid = [[ @@ -512,7 +512,7 @@ describe('ext_hlstate detailed highlights', function() end insert('last line') - helpers.feed('gg') + t.feed('gg') screen:expect { grid = [[ ^first line | @@ -555,7 +555,7 @@ describe('ext_hlstate detailed highlights', function() }, } - helpers.feed(string.format('3ggV%ijd', num_lines - 2)) + t.feed(string.format('3ggV%ijd', num_lines - 2)) --screen:redraw_debug(nil, nil, 100000) local expected_ids = {} diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index d143c594f5..8f9cc868fc 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -1,22 +1,22 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local expect = helpers.expect -local feed = helpers.feed -local insert = helpers.insert -local fn = helpers.fn -local api = helpers.api -local neq = helpers.neq -local ok = helpers.ok -local retry = helpers.retry -local source = helpers.source -local poke_eventloop = helpers.poke_eventloop +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local expect = t.expect +local feed = t.feed +local insert = t.insert +local fn = t.fn +local api = t.api +local neq = t.neq +local ok = t.ok +local retry = t.retry +local source = t.source +local poke_eventloop = t.poke_eventloop local sleep = vim.uv.sleep -local testprg = helpers.testprg -local assert_alive = helpers.assert_alive +local testprg = t.testprg +local assert_alive = t.assert_alive local default_text = [[ Inc substitution on @@ -1736,9 +1736,9 @@ describe("'inccommand' autocommands", function() CmdwinLeave = {}, } - local function bufferlist(t) + local function bufferlist(q) local s = '' - for _, buffer in pairs(t) do + for _, buffer in pairs(q) do s = s .. ', ' .. tostring(buffer) end return s @@ -2559,7 +2559,7 @@ describe(':substitute', function() end) it(':substitute with inccommand during :terminal activity', function() - if helpers.skip_fragile(pending) then + if t.skip_fragile(pending) then return end retry(2, 40000, function() diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua index a714df72b7..0f95d2d856 100644 --- a/test/functional/ui/inccommand_user_spec.lua +++ b/test/functional/ui/inccommand_user_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local api = helpers.api -local clear = helpers.clear -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local insert = helpers.insert -local feed = helpers.feed -local command = helpers.command -local assert_alive = helpers.assert_alive +local api = t.api +local clear = t.clear +local eq = t.eq +local exec_lua = t.exec_lua +local insert = t.insert +local feed = t.feed +local command = t.command +local assert_alive = t.assert_alive -- Implements a :Replace command that works like :substitute and has multibuffer support. local setup_replace_cmd = [[ diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 9c18127875..5d2ebb8c2e 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed_command = helpers.clear, helpers.feed_command -local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq -local command = helpers.command -local expect = helpers.expect -local curbuf_contents = helpers.curbuf_contents -local api = helpers.api -local exec_lua = helpers.exec_lua -local write_file = helpers.write_file -local fn = helpers.fn -local eval = helpers.eval +local t = require('test.functional.testutil')(after_each) +local clear, feed_command = t.clear, t.feed_command +local feed, next_msg, eq = t.feed, t.next_msg, t.eq +local command = t.command +local expect = t.expect +local curbuf_contents = t.curbuf_contents +local api = t.api +local exec_lua = t.exec_lua +local write_file = t.write_file +local fn = t.fn +local eval = t.eval local Screen = require('test.functional.ui.screen') before_each(clear) diff --git a/test/functional/ui/linematch_spec.lua b/test/functional/ui/linematch_spec.lua index 2733902615..c917b2c8f0 100644 --- a/test/functional/ui/linematch_spec.lua +++ b/test/functional/ui/linematch_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed = helpers.feed -local clear = helpers.clear -local write_file = helpers.write_file +local feed = t.feed +local clear = t.clear +local write_file = t.write_file describe('Diff mode screen with 3 diffs open', function() local fname = 'Xtest-functional-diff-screen-1' @@ -1094,10 +1094,10 @@ describe('regressions', function() screen = Screen.new(100, 20) screen:attach() -- line must be greater than MATCH_CHAR_MAX_LEN - helpers.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' }) - helpers.exec 'vnew' - helpers.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1010) .. 'world' }) - helpers.exec 'windo diffthis' + t.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' }) + t.exec 'vnew' + t.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1010) .. 'world' }) + t.exec 'windo diffthis' end) it('properly computes filler lines for hunks bigger than linematch limit', function() @@ -1109,10 +1109,10 @@ describe('regressions', function() for i = 0, 29 do lines[#lines + 1] = tostring(i) end - helpers.api.nvim_buf_set_lines(0, 0, -1, false, lines) - helpers.exec 'vnew' - helpers.api.nvim_buf_set_lines(0, 0, -1, false, { '00', '29' }) - helpers.exec 'windo diffthis' + t.api.nvim_buf_set_lines(0, 0, -1, false, lines) + t.exec 'vnew' + t.api.nvim_buf_set_lines(0, 0, -1, false, { '00', '29' }) + t.exec 'windo diffthis' feed('<C-e>') screen:expect { grid = [[ diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 5faa2b95a9..f66c7da4d9 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -1,26 +1,26 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed = helpers.clear, helpers.feed -local eval = helpers.eval -local eq = helpers.eq -local neq = helpers.neq -local command = helpers.command -local set_method_error = helpers.set_method_error -local api = helpers.api -local async_meths = helpers.async_meths -local test_build_dir = helpers.paths.test_build_dir -local nvim_prog = helpers.nvim_prog -local testprg = helpers.testprg -local exec = helpers.exec -local exec_capture = helpers.exec_capture -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local poke_eventloop = helpers.poke_eventloop -local assert_alive = helpers.assert_alive -local retry = helpers.retry -local is_os = helpers.is_os -local fn = helpers.fn -local skip = helpers.skip +local clear, feed = t.clear, t.feed +local eval = t.eval +local eq = t.eq +local neq = t.neq +local command = t.command +local set_method_error = t.set_method_error +local api = t.api +local async_meths = t.async_meths +local test_build_dir = t.paths.test_build_dir +local nvim_prog = t.nvim_prog +local testprg = t.testprg +local exec = t.exec +local exec_capture = t.exec_capture +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local poke_eventloop = t.poke_eventloop +local assert_alive = t.assert_alive +local retry = t.retry +local is_os = t.is_os +local fn = t.fn +local skip = t.skip describe('ui/ext_messages', function() local screen @@ -2683,13 +2683,13 @@ end) it('pager works in headless mode with UI attached', function() skip(is_os('win')) clear() - local child_server = assert(helpers.new_pipename()) + local child_server = assert(t.new_pipename()) fn.jobstart({ nvim_prog, '--clean', '--headless', '--listen', child_server }) retry(nil, nil, function() neq(nil, vim.uv.fs_stat(child_server)) end) - local child_session = helpers.connect(child_server) + local child_session = t.connect(child_server) local child_screen = Screen.new(40, 6) child_screen:attach(nil, child_session) child_screen._default_attr_ids = nil -- TODO: unskip with new color scheme diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua index 262b63977b..8b27d26217 100644 --- a/test/functional/ui/mode_spec.lua +++ b/test/functional/ui/mode_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command = helpers.command -local retry = helpers.retry +local clear, feed, insert = t.clear, t.feed, t.insert +local command = t.command +local retry = t.retry describe('ui mode_change event', function() local screen diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 11fb0ffaca..41507e754d 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, api = helpers.clear, helpers.feed, helpers.api -local insert, feed_command = helpers.insert, helpers.feed_command -local eq, fn = helpers.eq, helpers.fn -local poke_eventloop = helpers.poke_eventloop -local command = helpers.command -local exec = helpers.exec +local clear, feed, api = t.clear, t.feed, t.api +local insert, feed_command = t.insert, t.feed_command +local eq, fn = t.eq, t.fn +local poke_eventloop = t.poke_eventloop +local command = t.command +local exec = t.exec describe('ui/mouse/input', function() local screen @@ -575,7 +575,7 @@ describe('ui/mouse/input', function() :tabprevious | ]]) feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab - helpers.poke_eventloop() + t.poke_eventloop() feed('<LeftMouse><0,1>') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -1856,8 +1856,8 @@ describe('ui/mouse/input', function() it('feeding <MouseMove> in Normal mode does not use uninitialized memory #19480', function() feed('<MouseMove>') - helpers.poke_eventloop() - helpers.assert_alive() + t.poke_eventloop() + t.assert_alive() end) it('mousemodel=popup_setpos', function() diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua index 3149f8e8c6..0f3e6e6b6c 100644 --- a/test/functional/ui/multibyte_spec.lua +++ b/test/functional/ui/multibyte_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed -local feed_command = helpers.feed_command -local insert = helpers.insert -local fn = helpers.fn -local api = helpers.api +local clear = t.clear +local command = t.command +local feed = t.feed +local feed_command = t.feed_command +local insert = t.insert +local fn = t.fn +local api = t.api local split = vim.split -local dedent = helpers.dedent +local dedent = t.dedent describe('multibyte rendering', function() local screen diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index bb490546f6..20d3631930 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local feed, command, insert = helpers.feed, helpers.command, helpers.insert -local eq = helpers.eq -local fn = helpers.fn -local api = helpers.api -local curwin = helpers.api.nvim_get_current_win -local poke_eventloop = helpers.poke_eventloop +local clear = t.clear +local feed, command, insert = t.feed, t.command, t.insert +local eq = t.eq +local fn = t.fn +local api = t.api +local curwin = t.api.nvim_get_current_win +local poke_eventloop = t.poke_eventloop describe('ext_multigrid', function() diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index 98af82a7c5..b1d10c28c4 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local shallowcopy = helpers.shallowcopy -local eval = helpers.eval +local clear = t.clear +local command = t.command +local eq = t.eq +local shallowcopy = t.shallowcopy +local eval = t.eval describe('UI receives option updates', function() local screen diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index e2315ca7b4..b8a73b1c61 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -1,19 +1,20 @@ local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local child_session = require('test.functional.terminal.helpers') -local assert_alive = helpers.assert_alive -local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir -local eq = helpers.eq -local feed = helpers.feed -local feed_command = helpers.feed_command -local clear = helpers.clear -local command = helpers.command -local testprg = helpers.testprg -local nvim_dir = helpers.nvim_dir -local has_powershell = helpers.has_powershell -local set_shell_powershell = helpers.set_shell_powershell -local skip = helpers.skip -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local tt = require('test.functional.terminal.testutil') + +local assert_alive = t.assert_alive +local mkdir, write_file, rmdir = t.mkdir, t.write_file, t.rmdir +local eq = t.eq +local feed = t.feed +local feed_command = t.feed_command +local clear = t.clear +local command = t.command +local testprg = t.testprg +local nvim_dir = t.nvim_dir +local has_powershell = t.has_powershell +local set_shell_powershell = t.set_shell_powershell +local skip = t.skip +local is_os = t.is_os clear() -- for has_powershell() @@ -21,7 +22,7 @@ describe('shell command :!', function() local screen before_each(function() clear() - screen = child_session.setup_child_nvim({ + screen = tt.setup_child_nvim({ '-u', 'NONE', '-i', @@ -29,7 +30,7 @@ describe('shell command :!', function() '--cmd', 'colorscheme vim', '--cmd', - helpers.nvim_set .. ' notermguicolors', + t.nvim_set .. ' notermguicolors', }) screen:expect([[ {1: } | @@ -40,14 +41,14 @@ describe('shell command :!', function() end) after_each(function() - child_session.feed_data('\3') -- Ctrl-C + tt.feed_data('\3') -- Ctrl-C end) it('displays output without LF/EOF. #4646 #4569 #3772', function() skip(is_os('win')) -- NOTE: We use a child nvim (within a :term buffer) -- to avoid triggering a UI flush. - child_session.feed_data(':!printf foo; sleep 200\n') + tt.feed_data(':!printf foo; sleep 200\n') screen:expect([[ | {4:~ }|*2 @@ -61,7 +62,7 @@ describe('shell command :!', function() it('throttles shell-command output greater than ~10KB', function() skip(is_os('openbsd'), 'FIXME #10804') skip(is_os('win')) - child_session.feed_data((':!%s REP 30001 foo\n'):format(testprg('shell-test'))) + tt.feed_data((':!%s REP 30001 foo\n'):format(testprg('shell-test'))) -- If we observe any line starting with a dot, then throttling occurred. -- Avoid false failure on slow systems. @@ -80,7 +81,7 @@ describe('shell command :!', function() {3:-- TERMINAL --} | ]], { - -- test/functional/helpers.lua defaults to background=light. + -- test/functional/t.lua defaults to background=light. [1] = { reverse = true }, [3] = { bold = true }, [10] = { foreground = 2 }, diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index c1cb2b62be..9065e14c60 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local clear, feed = helpers.clear, helpers.feed -local source = helpers.source -local insert = helpers.insert -local api = helpers.api -local async_meths = helpers.async_meths -local command = helpers.command -local fn = helpers.fn -local eq = helpers.eq -local pcall_err = helpers.pcall_err -local exec_lua = helpers.exec_lua -local exec = helpers.exec +local assert_alive = t.assert_alive +local clear, feed = t.clear, t.feed +local source = t.source +local insert = t.insert +local api = t.api +local async_meths = t.async_meths +local command = t.command +local fn = t.fn +local eq = t.eq +local pcall_err = t.pcall_err +local exec_lua = t.exec_lua +local exec = t.exec describe('ui/ext_popupmenu', function() local screen diff --git a/test/functional/ui/quickfix_spec.lua b/test/functional/ui/quickfix_spec.lua index 40f8ef353a..d6c872b66e 100644 --- a/test/functional/ui/quickfix_spec.lua +++ b/test/functional/ui/quickfix_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, api = helpers.clear, helpers.feed, helpers.api -local insert, command = helpers.insert, helpers.command +local clear, feed, api = t.clear, t.feed, t.api +local insert, command = t.insert, t.command describe('quickfix selection highlight', function() local screen diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index ab535afbf4..b08a5b93a6 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -70,17 +70,17 @@ -- To help write screen tests, see Screen:snapshot_util(). -- To debug screen tests, see Screen:redraw_debug(). -local helpers = require('test.functional.helpers')(nil) +local t = require('test.functional.testutil')(nil) local busted = require('busted') local deepcopy = vim.deepcopy -local shallowcopy = helpers.shallowcopy -local concat_tables = helpers.concat_tables +local shallowcopy = t.shallowcopy +local concat_tables = t.concat_tables local pesc = vim.pesc -local run_session = helpers.run_session -local eq = helpers.eq -local dedent = helpers.dedent -local get_session = helpers.get_session -local create_callindex = helpers.create_callindex +local run_session = t.run_session +local eq = t.eq +local dedent = t.dedent +local get_session = t.get_session +local create_callindex = t.create_callindex local inspect = vim.inspect diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index adb1fd31f4..259baf725a 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear -local feed, command = helpers.feed, helpers.command -local insert = helpers.insert -local eq = helpers.eq -local fn, api = helpers.fn, helpers.api +local spawn, set_session, clear = t.spawn, t.set_session, t.clear +local feed, command = t.feed, t.command +local insert = t.insert +local eq = t.eq +local fn, api = t.fn, t.api describe('screen', function() local screen local nvim_argv = { - helpers.nvim_prog, + t.nvim_prog, '-u', 'NONE', '-i', @@ -700,7 +700,7 @@ describe('Screen default colors', function() local extra = (light and ' background=light') or '' local nvim_argv = { - helpers.nvim_prog, + t.nvim_prog, '-u', 'NONE', '-i', diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index cfc0f2f6de..592aea79c4 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command = helpers.command -local feed_command = helpers.feed_command -local eq = helpers.eq -local eval = helpers.eval -local fn = helpers.fn -local testprg = helpers.testprg +local clear, feed, insert = t.clear, t.feed, t.insert +local command = t.command +local feed_command = t.feed_command +local eq = t.eq +local eval = t.eval +local fn = t.fn +local testprg = t.testprg describe('search highlighting', function() local screen diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 847a918dc9..a1a21dece3 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local api, clear, eq = helpers.api, helpers.clear, helpers.eq -local eval, exec, feed = helpers.eval, helpers.exec, helpers.feed +local api, clear, eq = t.api, t.clear, t.eq +local eval, exec, feed = t.eval, t.exec, t.feed describe('Signs', function() local screen diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua index 8b5644ee42..4d960eb47c 100644 --- a/test/functional/ui/spell_spec.lua +++ b/test/functional/ui/spell_spec.lua @@ -1,13 +1,13 @@ -- Test for scenarios involving 'spell' -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local exec = helpers.exec -local feed = helpers.feed -local insert = helpers.insert -local api = helpers.api -local is_os = helpers.is_os +local clear = t.clear +local exec = t.exec +local feed = t.feed +local insert = t.insert +local api = t.api +local is_os = t.is_os describe("'spell'", function() local screen diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index 289badb859..9d60e14bec 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local exec = helpers.exec -local eval = helpers.eval -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local api = helpers.api -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive +local clear = t.clear +local command = t.command +local eq = t.eq +local exec = t.exec +local eval = t.eval +local exec_lua = t.exec_lua +local feed = t.feed +local api = t.api +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive local mousemodels = { 'extend', 'popup', 'popup_setpos' } diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index 598dcab8d3..d359efbee9 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -1,17 +1,17 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local assert_alive = helpers.assert_alive -local clear = helpers.clear -local command = helpers.command -local feed = helpers.feed -local eq = helpers.eq -local fn = helpers.fn -local api = helpers.api -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local eval = helpers.eval +local assert_alive = t.assert_alive +local clear = t.clear +local command = t.command +local feed = t.feed +local eq = t.eq +local fn = t.fn +local api = t.api +local exec = t.exec +local exec_lua = t.exec_lua +local eval = t.eval local sleep = vim.uv.sleep -local pcall_err = helpers.pcall_err +local pcall_err = t.pcall_err local mousemodels = { 'extend', 'popup', 'popup_setpos' } diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua index ccf758bc07..c6109ad713 100644 --- a/test/functional/ui/syntax_conceal_spec.lua +++ b/test/functional/ui/syntax_conceal_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, command = helpers.clear, helpers.feed, helpers.command -local eq = helpers.eq -local insert = helpers.insert -local poke_eventloop = helpers.poke_eventloop -local exec = helpers.exec +local clear, feed, command = t.clear, t.feed, t.command +local eq = t.eq +local insert = t.insert +local poke_eventloop = t.poke_eventloop +local exec = t.exec describe('Screen', function() local screen diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua index c7cb0af826..dc9dc31295 100644 --- a/test/functional/ui/tabline_spec.lua +++ b/test/functional/ui/tabline_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, command, eq = helpers.clear, helpers.command, helpers.eq -local insert = helpers.insert -local api = helpers.api -local assert_alive = helpers.assert_alive +local clear, command, eq = t.clear, t.command, t.eq +local insert = t.insert +local api = t.api +local assert_alive = t.assert_alive describe('ui/ext_tabline', function() local screen diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua index 8060d3a460..bddf37d801 100644 --- a/test/functional/ui/title_spec.lua +++ b/test/functional/ui/title_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local curwin = helpers.api.nvim_get_current_win -local eq = helpers.eq -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local fn = helpers.fn -local api = helpers.api -local is_os = helpers.is_os +local clear = t.clear +local command = t.command +local curwin = t.api.nvim_get_current_win +local eq = t.eq +local exec_lua = t.exec_lua +local feed = t.feed +local fn = t.fn +local api = t.api +local is_os = t.is_os describe('title', function() local screen diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 5b83a1c6aa..228942e964 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, command = helpers.clear, helpers.feed, helpers.command -local fn = helpers.fn -local api = helpers.api -local eq = helpers.eq -local eval = helpers.eval -local retry = helpers.retry -local testprg = helpers.testprg -local is_os = helpers.is_os +local clear, feed, command = t.clear, t.feed, t.command +local fn = t.fn +local api = t.api +local eq = t.eq +local eval = t.eval +local retry = t.retry +local testprg = t.testprg +local is_os = t.is_os describe("'wildmenu'", function() local screen diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua index f84f68f9e2..02e7f1d3f3 100644 --- a/test/functional/ui/winbar_spec.lua +++ b/test/functional/ui/winbar_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local insert = helpers.insert -local api = helpers.api -local eq = helpers.eq -local poke_eventloop = helpers.poke_eventloop -local feed = helpers.feed -local fn = helpers.fn -local pcall_err = helpers.pcall_err +local clear = t.clear +local command = t.command +local insert = t.insert +local api = t.api +local eq = t.eq +local poke_eventloop = t.poke_eventloop +local feed = t.feed +local fn = t.fn +local pcall_err = t.pcall_err describe('winbar', function() local screen diff --git a/test/functional/vimscript/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua index 4985768bb0..10a98b646e 100644 --- a/test/functional/vimscript/api_functions_spec.lua +++ b/test/functional/vimscript/api_functions_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local neq, eq, command = helpers.neq, helpers.eq, helpers.command -local clear = helpers.clear -local exc_exec, expect, eval = helpers.exc_exec, helpers.expect, helpers.eval -local exec_lua = helpers.exec_lua -local insert, pcall_err = helpers.insert, helpers.pcall_err -local matches = helpers.matches -local api = helpers.api -local feed = helpers.feed +local neq, eq, command = t.neq, t.eq, t.command +local clear = t.clear +local exc_exec, expect, eval = t.exc_exec, t.expect, t.eval +local exec_lua = t.exec_lua +local insert, pcall_err = t.insert, t.pcall_err +local matches = t.matches +local api = t.api +local feed = t.feed describe('eval-API', function() before_each(clear) diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index 931fe640a9..5cecafa370 100644 --- a/test/functional/vimscript/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local fn = helpers.fn -local api = helpers.api -local command = helpers.command -local exc_exec = helpers.exc_exec -local get_pathsep = helpers.get_pathsep -local rmdir = helpers.rmdir -local pcall_err = helpers.pcall_err -local mkdir = helpers.mkdir +local eq = t.eq +local clear = t.clear +local fn = t.fn +local api = t.api +local command = t.command +local exc_exec = t.exc_exec +local get_pathsep = t.get_pathsep +local rmdir = t.rmdir +local pcall_err = t.pcall_err +local mkdir = t.mkdir local fname = 'Xtest-functional-eval-buf_functions' local fname2 = fname .. '.2' diff --git a/test/functional/vimscript/changedtick_spec.lua b/test/functional/vimscript/changedtick_spec.lua index 85928921c5..09aaea900b 100644 --- a/test/functional/vimscript/changedtick_spec.lua +++ b/test/functional/vimscript/changedtick_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed -local clear = helpers.clear -local fn = helpers.fn -local api = helpers.api -local command = helpers.command -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err -local exec_capture = helpers.exec_capture +local eq = t.eq +local eval = t.eval +local feed = t.feed +local clear = t.clear +local fn = t.fn +local api = t.api +local command = t.command +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err +local exec_capture = t.exec_capture before_each(clear) diff --git a/test/functional/vimscript/container_functions_spec.lua b/test/functional/vimscript/container_functions_spec.lua index 1b34ea0165..c3acaa710f 100644 --- a/test/functional/vimscript/container_functions_spec.lua +++ b/test/functional/vimscript/container_functions_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local eval = helpers.eval -local api = helpers.api -local clear = helpers.clear +local eq = t.eq +local eval = t.eval +local api = t.api +local clear = t.clear before_each(clear) diff --git a/test/functional/vimscript/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua index dc60a474f3..c82ce350b3 100644 --- a/test/functional/vimscript/ctx_functions_spec.lua +++ b/test/functional/vimscript/ctx_functions_spec.lua @@ -1,19 +1,19 @@ -local helpers = require('test.functional.helpers')(after_each) - -local call = helpers.call -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local eval = helpers.eval -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) + +local call = t.call +local clear = t.clear +local command = t.command +local eq = t.eq +local eval = t.eval +local feed = t.feed local map = vim.tbl_map -local api = helpers.api -local parse_context = helpers.parse_context -local exec_capture = helpers.exec_capture -local source = helpers.source +local api = t.api +local parse_context = t.parse_context +local exec_capture = t.exec_capture +local source = t.source local trim = vim.trim -local write_file = helpers.write_file -local pcall_err = helpers.pcall_err +local write_file = t.write_file +local pcall_err = t.pcall_err describe('context functions', function() local fname1 = 'Xtest-functional-eval-ctx1' diff --git a/test/functional/vimscript/environ_spec.lua b/test/functional/vimscript/environ_spec.lua index 0763def84e..b4c7b30421 100644 --- a/test/functional/vimscript/environ_spec.lua +++ b/test/functional/vimscript/environ_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local environ = helpers.fn.environ -local exists = helpers.fn.exists -local system = helpers.fn.system -local nvim_prog = helpers.nvim_prog -local command = helpers.command -local eval = helpers.eval -local setenv = helpers.fn.setenv +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local environ = t.fn.environ +local exists = t.fn.exists +local system = t.fn.system +local nvim_prog = t.nvim_prog +local command = t.command +local eval = t.eval +local setenv = t.fn.setenv describe('environment variables', function() it('environ() handles empty env variable', function() diff --git a/test/functional/vimscript/errorlist_spec.lua b/test/functional/vimscript/errorlist_spec.lua index 1e405e7e64..5fcdc65de1 100644 --- a/test/functional/vimscript/errorlist_spec.lua +++ b/test/functional/vimscript/errorlist_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local command = helpers.command -local eq = helpers.eq -local exc_exec = helpers.exc_exec -local get_win_var = helpers.api.nvim_win_get_var +local clear = t.clear +local command = t.command +local eq = t.eq +local exc_exec = t.exc_exec +local get_win_var = t.api.nvim_win_get_var describe('setqflist()', function() - local setqflist = helpers.fn.setqflist + local setqflist = t.fn.setqflist before_each(clear) @@ -46,7 +46,7 @@ describe('setqflist()', function() end) describe('setloclist()', function() - local setloclist = helpers.fn.setloclist + local setloclist = t.fn.setloclist before_each(clear) @@ -73,7 +73,7 @@ describe('setloclist()', function() end) it("doesn't crash when when window is closed in the middle #13721", function() - helpers.insert([[ + t.insert([[ hello world]]) command('vsplit') @@ -82,6 +82,6 @@ describe('setloclist()', function() command('call setloclist(0, [])') command('lopen') - helpers.assert_alive() + t.assert_alive() end) end) diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua index e337959810..0918c5957a 100644 --- a/test/functional/vimscript/eval_spec.lua +++ b/test/functional/vimscript/eval_spec.lua @@ -9,37 +9,37 @@ -- test/functional/vimscript/<funcname>_spec.lua -- test/functional/vimscript/functions_spec.lua -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local mkdir = helpers.mkdir -local clear = helpers.clear -local eq = helpers.eq -local exec = helpers.exec -local exc_exec = helpers.exc_exec -local exec_lua = helpers.exec_lua -local exec_capture = helpers.exec_capture -local eval = helpers.eval -local command = helpers.command -local write_file = helpers.write_file -local api = helpers.api +local mkdir = t.mkdir +local clear = t.clear +local eq = t.eq +local exec = t.exec +local exc_exec = t.exc_exec +local exec_lua = t.exec_lua +local exec_capture = t.exec_capture +local eval = t.eval +local command = t.command +local write_file = t.write_file +local api = t.api local sleep = vim.uv.sleep -local matches = helpers.matches -local pcall_err = helpers.pcall_err -local assert_alive = helpers.assert_alive -local poke_eventloop = helpers.poke_eventloop -local feed = helpers.feed -local expect_exit = helpers.expect_exit +local matches = t.matches +local pcall_err = t.pcall_err +local assert_alive = t.assert_alive +local poke_eventloop = t.poke_eventloop +local feed = t.feed +local expect_exit = t.expect_exit describe('Up to MAX_FUNC_ARGS arguments are handled by', function() local max_func_args = 20 -- from eval.h - local range = helpers.fn.range + local range = t.fn.range before_each(clear) it('printf()', function() - local printf = helpers.fn.printf - local rep = helpers.fn['repeat'] + local printf = t.fn.printf + local rep = t.fn['repeat'] local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,' eq(expected, printf(rep('%d,', max_func_args - 1), unpack(range(2, max_func_args)))) local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') @@ -47,7 +47,7 @@ describe('Up to MAX_FUNC_ARGS arguments are handled by', function() end) it('rpcnotify()', function() - local rpcnotify = helpers.fn.rpcnotify + local rpcnotify = t.fn.rpcnotify local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args))) eq(1, ret) ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') @@ -69,17 +69,17 @@ describe('backtick expansion', function() end) teardown(function() - helpers.rmdir('test-backticks') + t.rmdir('test-backticks') end) it("with default 'shell'", function() - if helpers.is_os('win') then + if t.is_os('win') then command(':silent args `dir /b *2`') else command(':silent args `echo ***2`') end eq({ 'file2' }, eval('argv()')) - if helpers.is_os('win') then + if t.is_os('win') then command(':silent args `dir /s/b *4`') eq({ 'subdir\\file4' }, eval('map(argv(), \'fnamemodify(v:val, ":.")\')')) else diff --git a/test/functional/vimscript/executable_spec.lua b/test/functional/vimscript/executable_spec.lua index 1d95f6088e..de16563eed 100644 --- a/test/functional/vimscript/executable_spec.lua +++ b/test/functional/vimscript/executable_spec.lua @@ -1,9 +1,8 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, clear, call, write_file, command = - helpers.eq, helpers.clear, helpers.call, helpers.write_file, helpers.command -local exc_exec = helpers.exc_exec -local eval = helpers.eval -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local eq, clear, call, write_file, command = t.eq, t.clear, t.call, t.write_file, t.command +local exc_exec = t.exc_exec +local eval = t.eval +local is_os = t.is_os describe('executable()', function() before_each(clear) diff --git a/test/functional/vimscript/execute_spec.lua b/test/functional/vimscript/execute_spec.lua index ce66545c82..b765f50fe4 100644 --- a/test/functional/vimscript/execute_spec.lua +++ b/test/functional/vimscript/execute_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local eval = helpers.eval -local clear = helpers.clear -local source = helpers.source -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err -local fn = helpers.fn +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local eval = t.eval +local clear = t.clear +local source = t.source +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err +local fn = t.fn local Screen = require('test.functional.ui.screen') -local command = helpers.command -local feed = helpers.feed -local is_os = helpers.is_os +local command = t.command +local feed = t.feed +local is_os = t.is_os describe('execute()', function() before_each(clear) diff --git a/test/functional/vimscript/exepath_spec.lua b/test/functional/vimscript/exepath_spec.lua index 01033a2140..57242a2483 100644 --- a/test/functional/vimscript/exepath_spec.lua +++ b/test/functional/vimscript/exepath_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq, clear, call = helpers.eq, helpers.clear, helpers.call -local command = helpers.command -local exc_exec = helpers.exc_exec -local matches = helpers.matches -local is_os = helpers.is_os -local set_shell_powershell = helpers.set_shell_powershell -local eval = helpers.eval +local t = require('test.functional.testutil')(after_each) +local eq, clear, call = t.eq, t.clear, t.call +local command = t.command +local exc_exec = t.exc_exec +local matches = t.matches +local is_os = t.is_os +local set_shell_powershell = t.set_shell_powershell +local eval = t.eval local find_dummies = function(ext_pat) local tmp_path = eval('$PATH') diff --git a/test/functional/vimscript/fnamemodify_spec.lua b/test/functional/vimscript/fnamemodify_spec.lua index 4a134fe23c..0706a60f57 100644 --- a/test/functional/vimscript/fnamemodify_spec.lua +++ b/test/functional/vimscript/fnamemodify_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local fnamemodify = helpers.fn.fnamemodify -local getcwd = helpers.fn.getcwd -local command = helpers.command -local write_file = helpers.write_file -local alter_slashes = helpers.alter_slashes -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local fnamemodify = t.fn.fnamemodify +local getcwd = t.fn.getcwd +local command = t.command +local write_file = t.write_file +local alter_slashes = t.alter_slashes +local is_os = t.is_os local function eq_slashconvert(expected, got) eq(alter_slashes(expected), alter_slashes(got)) @@ -24,7 +24,7 @@ describe('fnamemodify()', function() end) it('handles the root path', function() - local root = helpers.pathroot() + local root = t.pathroot() eq(root, fnamemodify([[/]], ':p:h')) eq(root, fnamemodify([[/]], ':p')) if is_os('win') then diff --git a/test/functional/vimscript/functions_spec.lua b/test/functional/vimscript/functions_spec.lua index 09b3334989..cb4d329ae9 100644 --- a/test/functional/vimscript/functions_spec.lua +++ b/test/functional/vimscript/functions_spec.lua @@ -5,12 +5,12 @@ -- -- Core "eval" tests live in eval_spec.lua. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eval = helpers.eval -local matches = helpers.matches -local is_os = helpers.is_os +local clear = t.clear +local eval = t.eval +local matches = t.matches +local is_os = t.is_os before_each(clear) diff --git a/test/functional/vimscript/getline_spec.lua b/test/functional/vimscript/getline_spec.lua index 08e7711b8c..600730c010 100644 --- a/test/functional/vimscript/getline_spec.lua +++ b/test/functional/vimscript/getline_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local call = helpers.call -local clear = helpers.clear -local eq = helpers.eq -local expect = helpers.expect +local call = t.call +local clear = t.clear +local eq = t.eq +local expect = t.expect describe('getline()', function() before_each(function() diff --git a/test/functional/vimscript/glob_spec.lua b/test/functional/vimscript/glob_spec.lua index 77351f95fa..708b976dbb 100644 --- a/test/functional/vimscript/glob_spec.lua +++ b/test/functional/vimscript/glob_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, command, eval, eq = helpers.clear, helpers.command, helpers.eval, helpers.eq -local mkdir = helpers.mkdir +local t = require('test.functional.testutil')(after_each) +local clear, command, eval, eq = t.clear, t.command, t.eval, t.eq +local mkdir = t.mkdir before_each(function() clear() diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua index 82b3db5b67..08193f8d02 100644 --- a/test/functional/vimscript/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local connect = helpers.connect -local eq = helpers.eq -local fn = helpers.fn -local is_os = helpers.is_os -local nvim_prog = helpers.nvim_prog +local clear = t.clear +local connect = t.connect +local eq = t.eq +local fn = t.fn +local is_os = t.is_os +local nvim_prog = t.nvim_prog describe('has()', function() before_each(clear) diff --git a/test/functional/vimscript/hostname_spec.lua b/test/functional/vimscript/hostname_spec.lua index 62520e8222..024997f6b0 100644 --- a/test/functional/vimscript/hostname_spec.lua +++ b/test/functional/vimscript/hostname_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local ok = helpers.ok -local call = helpers.call -local clear = helpers.clear -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local ok = t.ok +local call = t.call +local clear = t.clear +local is_os = t.is_os describe('hostname()', function() before_each(clear) diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua index d64ae3b0f1..0ac22c7320 100644 --- a/test/functional/vimscript/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local feed = helpers.feed -local api = helpers.api -local clear = helpers.clear -local source = helpers.source -local command = helpers.command -local exc_exec = helpers.exc_exec -local async_meths = helpers.async_meths +local eq = t.eq +local feed = t.feed +local api = t.api +local clear = t.clear +local source = t.source +local command = t.command +local exc_exec = t.exc_exec +local async_meths = t.async_meths local NIL = vim.NIL local screen diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua index ef0359263e..e4a9c41d59 100644 --- a/test/functional/vimscript/json_functions_spec.lua +++ b/test/functional/vimscript/json_functions_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local fn = helpers.fn -local api = helpers.api -local eq = helpers.eq -local eval = helpers.eval -local command = helpers.command -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local fn = t.fn +local api = t.api +local eq = t.eq +local eval = t.eval +local command = t.command +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err local NIL = vim.NIL -local source = helpers.source +local source = t.source describe('json_decode() function', function() local restart = function(...) diff --git a/test/functional/vimscript/lang_spec.lua b/test/functional/vimscript/lang_spec.lua index 2dde90e334..cad3df9aef 100644 --- a/test/functional/vimscript/lang_spec.lua +++ b/test/functional/vimscript/lang_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq -local exc_exec, source = helpers.exc_exec, helpers.source +local t = require('test.functional.testutil')(after_each) +local clear, eval, eq = t.clear, t.eval, t.eq +local exc_exec, source = t.exc_exec, t.source describe('vimscript', function() before_each(clear) diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua index 15d4b189b8..bcfd12cbe8 100644 --- a/test/functional/vimscript/let_spec.lua +++ b/test/functional/vimscript/let_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local command = helpers.command -local eval = helpers.eval -local api = helpers.api -local exec = helpers.exec -local exec_capture = helpers.exec_capture -local expect_exit = helpers.expect_exit -local source = helpers.source -local testprg = helpers.testprg +local eq = t.eq +local clear = t.clear +local command = t.command +local eval = t.eval +local api = t.api +local exec = t.exec +local exec_capture = t.exec_capture +local expect_exit = t.expect_exit +local source = t.source +local testprg = t.testprg before_each(clear) diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua index 59d427ca90..fba3a627e9 100644 --- a/test/functional/vimscript/map_functions_spec.lua +++ b/test/functional/vimscript/map_functions_spec.lua @@ -1,18 +1,18 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local expect = helpers.expect -local feed = helpers.feed -local fn = helpers.fn -local api = helpers.api -local source = helpers.source -local command = helpers.command -local exec_capture = helpers.exec_capture -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) + +local clear = t.clear +local eq = t.eq +local eval = t.eval +local exec = t.exec +local exec_lua = t.exec_lua +local expect = t.expect +local feed = t.feed +local fn = t.fn +local api = t.api +local source = t.source +local command = t.command +local exec_capture = t.exec_capture +local pcall_err = t.pcall_err describe('maparg()', function() before_each(clear) diff --git a/test/functional/vimscript/match_functions_spec.lua b/test/functional/vimscript/match_functions_spec.lua index 3db612e472..2bff221c0b 100644 --- a/test/functional/vimscript/match_functions_spec.lua +++ b/test/functional/vimscript/match_functions_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local eq = helpers.eq -local clear = helpers.clear -local fn = helpers.fn -local command = helpers.command -local exc_exec = helpers.exc_exec +local eq = t.eq +local clear = t.clear +local fn = t.fn +local command = t.command +local exc_exec = t.exc_exec before_each(clear) diff --git a/test/functional/vimscript/minmax_functions_spec.lua b/test/functional/vimscript/minmax_functions_spec.lua index c4a986bc8c..dbdfc06afb 100644 --- a/test/functional/vimscript/minmax_functions_spec.lua +++ b/test/functional/vimscript/minmax_functions_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local eval = helpers.eval -local command = helpers.command -local clear = helpers.clear -local fn = helpers.fn -local pcall_err = helpers.pcall_err +local eq = t.eq +local eval = t.eval +local command = t.command +local clear = t.clear +local fn = t.fn +local pcall_err = t.pcall_err before_each(clear) for _, func in ipairs({ 'min', 'max' }) do diff --git a/test/functional/vimscript/modeline_spec.lua b/test/functional/vimscript/modeline_spec.lua index ae63a66f43..fde6dbef30 100644 --- a/test/functional/vimscript/modeline_spec.lua +++ b/test/functional/vimscript/modeline_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_alive = helpers.assert_alive -local clear, command, write_file = helpers.clear, helpers.command, helpers.write_file +local t = require('test.functional.testutil')(after_each) +local assert_alive = t.assert_alive +local clear, command, write_file = t.clear, t.command, t.write_file describe('modeline', function() - local tempfile = helpers.tmpname() + local tempfile = t.tmpname() before_each(clear) after_each(function() diff --git a/test/functional/vimscript/msgpack_functions_spec.lua b/test/functional/vimscript/msgpack_functions_spec.lua index 609a706155..55540712d7 100644 --- a/test/functional/vimscript/msgpack_functions_spec.lua +++ b/test/functional/vimscript/msgpack_functions_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local fn = helpers.fn -local eval, eq = helpers.eval, helpers.eq -local command = helpers.command -local api = helpers.api -local exc_exec = helpers.exc_exec -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local fn = t.fn +local eval, eq = t.eval, t.eq +local command = t.command +local api = t.api +local exc_exec = t.exc_exec +local is_os = t.is_os describe('msgpack*() functions', function() before_each(clear) @@ -469,12 +469,12 @@ describe('msgpackparse() function', function() end) it('msgpackparse(systemlist(...)) does not segfault. #3135', function() - local cmd = "sort(keys(msgpackparse(systemlist('" .. helpers.nvim_prog .. " --api-info'))[0]))" + local cmd = "sort(keys(msgpackparse(systemlist('" .. t.nvim_prog .. " --api-info'))[0]))" eval(cmd) eval(cmd) -- do it again (try to force segfault) local api_info = eval(cmd) -- do it again if is_os('win') then - helpers.assert_alive() + t.assert_alive() pending('msgpackparse() has a bug on windows') return end diff --git a/test/functional/vimscript/null_spec.lua b/test/functional/vimscript/null_spec.lua index 805cd13844..99abc9bcf4 100644 --- a/test/functional/vimscript/null_spec.lua +++ b/test/functional/vimscript/null_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local exc_exec = helpers.exc_exec -local command = helpers.command -local clear = helpers.clear -local api = helpers.api -local fn = helpers.fn -local eq = helpers.eq +local exc_exec = t.exc_exec +local command = t.command +local clear = t.clear +local api = t.api +local fn = t.fn +local eq = t.eq local function redir_exec(cmd) api.nvim_set_var('__redir_exec_cmd', cmd) diff --git a/test/functional/vimscript/operators_spec.lua b/test/functional/vimscript/operators_spec.lua index 64f6b60238..e3357d1dfd 100644 --- a/test/functional/vimscript/operators_spec.lua +++ b/test/functional/vimscript/operators_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq -local eval = helpers.eval -local clear = helpers.clear +local t = require('test.functional.testutil')(after_each) +local eq = t.eq +local eval = t.eval +local clear = t.clear describe('Division operator', function() before_each(clear) diff --git a/test/functional/vimscript/printf_spec.lua b/test/functional/vimscript/printf_spec.lua index 4fa4ea7f4c..365c10119a 100644 --- a/test/functional/vimscript/printf_spec.lua +++ b/test/functional/vimscript/printf_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local fn = helpers.fn -local api = helpers.api -local exc_exec = helpers.exc_exec +local clear = t.clear +local eq = t.eq +local eval = t.eval +local fn = t.fn +local api = t.api +local exc_exec = t.exc_exec describe('printf()', function() before_each(clear) diff --git a/test/functional/vimscript/reltime_spec.lua b/test/functional/vimscript/reltime_spec.lua index fc4dd0d87b..22c0bd5bb9 100644 --- a/test/functional/vimscript/reltime_spec.lua +++ b/test/functional/vimscript/reltime_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok -local neq, command, fn = helpers.neq, helpers.command, helpers.fn -local matches = helpers.matches +local t = require('test.functional.testutil')(after_each) +local clear, eq, ok = t.clear, t.eq, t.ok +local neq, command, fn = t.neq, t.command, t.fn +local matches = t.matches local reltime, reltimestr, reltimefloat = fn.reltime, fn.reltimestr, fn.reltimefloat describe('reltimestr(), reltimefloat()', function() diff --git a/test/functional/vimscript/screenchar_spec.lua b/test/functional/vimscript/screenchar_spec.lua index 48b6893865..08341193e0 100644 --- a/test/functional/vimscript/screenchar_spec.lua +++ b/test/functional/vimscript/screenchar_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq -local command, api, fn = helpers.command, helpers.api, helpers.fn +local t = require('test.functional.testutil')(after_each) +local clear, eq, neq = t.clear, t.eq, t.neq +local command, api, fn = t.command, t.api, t.fn local tbl_deep_extend = vim.tbl_deep_extend -- Set up two overlapping floating windows diff --git a/test/functional/vimscript/screenpos_spec.lua b/test/functional/vimscript/screenpos_spec.lua index b951d830a6..8c43a12810 100644 --- a/test/functional/vimscript/screenpos_spec.lua +++ b/test/functional/vimscript/screenpos_spec.lua @@ -1,7 +1,7 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eq, api = helpers.clear, helpers.eq, helpers.api -local command, fn = helpers.command, helpers.fn -local feed = helpers.feed +local t = require('test.functional.testutil')(after_each) +local clear, eq, api = t.clear, t.eq, t.api +local command, fn = t.command, t.fn +local feed = t.feed before_each(clear) diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua index f7fa4783a3..9b2c2eaf65 100644 --- a/test/functional/vimscript/server_spec.lua +++ b/test/functional/vimscript/server_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local assert_log = helpers.assert_log -local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval -local clear, fn, api = helpers.clear, helpers.fn, helpers.api -local ok = helpers.ok -local matches = helpers.matches -local pcall_err = helpers.pcall_err -local check_close = helpers.check_close -local mkdir = helpers.mkdir -local rmdir = helpers.rmdir -local is_os = helpers.is_os +local t = require('test.functional.testutil')(after_each) +local assert_log = t.assert_log +local eq, neq, eval = t.eq, t.neq, t.eval +local clear, fn, api = t.clear, t.fn, t.api +local ok = t.ok +local matches = t.matches +local pcall_err = t.pcall_err +local check_close = t.check_close +local mkdir = t.mkdir +local rmdir = t.rmdir +local is_os = t.is_os local testlog = 'Xtest-server-log' @@ -176,11 +176,11 @@ end) describe('startup --listen', function() it('validates', function() clear() - local cmd = { unpack(helpers.nvim_argv) } + local cmd = { unpack(t.nvim_argv) } table.insert(cmd, '--listen') matches('nvim.*: Argument missing after: "%-%-listen"', fn.system(cmd)) - cmd = { unpack(helpers.nvim_argv) } + cmd = { unpack(t.nvim_argv) } table.insert(cmd, '--listen2') matches('nvim.*: Garbage after option argument: "%-%-listen2"', fn.system(cmd)) end) diff --git a/test/functional/vimscript/setpos_spec.lua b/test/functional/vimscript/setpos_spec.lua index a26e48f469..6398aba79d 100644 --- a/test/functional/vimscript/setpos_spec.lua +++ b/test/functional/vimscript/setpos_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local setpos = helpers.fn.setpos -local getpos = helpers.fn.getpos -local insert = helpers.insert -local clear = helpers.clear -local command = helpers.command -local eval = helpers.eval -local eq = helpers.eq -local exc_exec = helpers.exc_exec +local t = require('test.functional.testutil')(after_each) +local setpos = t.fn.setpos +local getpos = t.fn.getpos +local insert = t.insert +local clear = t.clear +local command = t.command +local eval = t.eval +local eq = t.eq +local exc_exec = t.exc_exec describe('setpos() function', function() before_each(function() diff --git a/test/functional/vimscript/sort_spec.lua b/test/functional/vimscript/sort_spec.lua index bd3d0da146..b1fa88e329 100644 --- a/test/functional/vimscript/sort_spec.lua +++ b/test/functional/vimscript/sort_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq +local eq = t.eq local NIL = vim.NIL -local eval = helpers.eval -local clear = helpers.clear -local api = helpers.api -local fn = helpers.fn -local command = helpers.command -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err +local eval = t.eval +local clear = t.clear +local api = t.api +local fn = t.fn +local command = t.command +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/vimscript/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua index 590d409141..79ec76f622 100644 --- a/test/functional/vimscript/special_vars_spec.lua +++ b/test/functional/vimscript/special_vars_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local exc_exec = helpers.exc_exec -local command = helpers.command -local fn = helpers.fn -local clear = helpers.clear -local eval = helpers.eval -local eq = helpers.eq -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local exc_exec = t.exc_exec +local command = t.command +local fn = t.fn +local clear = t.clear +local eval = t.eval +local eq = t.eq +local api = t.api local NIL = vim.NIL describe('Special values', function() diff --git a/test/functional/vimscript/state_spec.lua b/test/functional/vimscript/state_spec.lua index 7179806e36..f5f9b829f8 100644 --- a/test/functional/vimscript/state_spec.lua +++ b/test/functional/vimscript/state_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local feed = helpers.feed -local api = helpers.api -local poke_eventloop = helpers.poke_eventloop +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local exec = t.exec +local exec_lua = t.exec_lua +local feed = t.feed +local api = t.api +local poke_eventloop = t.poke_eventloop before_each(clear) diff --git a/test/functional/vimscript/string_spec.lua b/test/functional/vimscript/string_spec.lua index 6a7fe1bad9..859757c93c 100644 --- a/test/functional/vimscript/string_spec.lua +++ b/test/functional/vimscript/string_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local command = helpers.command -local api = helpers.api -local eval = helpers.eval -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err -local fn = helpers.fn +local t = require('test.functional.testutil')(after_each) +local clear = t.clear +local eq = t.eq +local command = t.command +local api = t.api +local eval = t.eval +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err +local fn = t.fn local NIL = vim.NIL -local source = helpers.source +local source = t.source describe('string() function', function() before_each(clear) @@ -190,7 +190,7 @@ describe('string() function', function() eval('add(l, l)') -- Regression: the below line used to crash (add returns original list and -- there was error in dumping partials). Tested explicitly in - -- test/unit/api/private_helpers_spec.lua. + -- test/unit/api/private_t_spec.lua. eval('add(l, function("Test1", l))') eq( [=[Vim(echo):E724: unable to correctly dump variable with self-referencing container]=], diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua index db27c5206f..1cbe9422e2 100644 --- a/test/functional/vimscript/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua @@ -1,24 +1,18 @@ -- Tests for system() and :! shell. -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local assert_alive = helpers.assert_alive -local testprg = helpers.testprg +local assert_alive = t.assert_alive +local testprg = t.testprg local eq, call, clear, eval, feed_command, feed, api = - helpers.eq, - helpers.call, - helpers.clear, - helpers.eval, - helpers.feed_command, - helpers.feed, - helpers.api -local command = helpers.command -local insert = helpers.insert -local expect = helpers.expect -local exc_exec = helpers.exc_exec -local os_kill = helpers.os_kill -local pcall_err = helpers.pcall_err -local is_os = helpers.is_os + t.eq, t.call, t.clear, t.eval, t.feed_command, t.feed, t.api +local command = t.command +local insert = t.insert +local expect = t.expect +local exc_exec = t.exc_exec +local os_kill = t.os_kill +local pcall_err = t.pcall_err +local is_os = t.is_os local Screen = require('test.functional.ui.screen') @@ -189,7 +183,7 @@ describe('system()', function() end) it('with powershell', function() - helpers.set_shell_powershell() + t.set_shell_powershell() eq('a\nb\n', eval([[system('Write-Output a b')]])) eq('C:\\\n', eval([[system('cd c:\; (Get-Location).Path')]])) eq('a b\n', eval([[system('Write-Output "a b"')]])) @@ -197,11 +191,11 @@ describe('system()', function() end it('powershell w/ UTF-8 text #13713', function() - if not helpers.has_powershell() then + if not t.has_powershell() then pending('powershell not found', function() end) return end - helpers.set_shell_powershell() + t.set_shell_powershell() eq('ああ\n', eval([[system('Write-Output "ああ"')]])) -- Sanity test w/ default encoding -- * on Windows, expected to default to Western European enc @@ -234,7 +228,7 @@ describe('system()', function() end) it('self and total time recorded separately', function() - local tempfile = helpers.tmpname() + local tempfile = t.tmpname() feed(':function! AlmostNoSelfTime()<cr>') feed('echo system("echo hi")<cr>') @@ -247,11 +241,11 @@ describe('system()', function() feed(':edit ' .. tempfile .. '<cr>') - local command_total_time = tonumber(helpers.fn.split(helpers.fn.getline(7))[2]) - local command_self_time = tonumber(helpers.fn.split(helpers.fn.getline(7))[3]) + local command_total_time = tonumber(t.fn.split(t.fn.getline(7))[2]) + local command_self_time = tonumber(t.fn.split(t.fn.getline(7))[3]) - helpers.neq(nil, command_total_time) - helpers.neq(nil, command_self_time) + t.neq(nil, command_total_time) + t.neq(nil, command_self_time) end) it('`yes` interrupted with CTRL-C', function() @@ -554,11 +548,11 @@ describe('systemlist()', function() end) it('powershell w/ UTF-8 text #13713', function() - if not helpers.has_powershell() then + if not t.has_powershell() then pending('powershell not found', function() end) return end - helpers.set_shell_powershell() + t.set_shell_powershell() eq({ is_os('win') and 'あ\r' or 'あ' }, eval([[systemlist('Write-Output あ')]])) -- Sanity test w/ default encoding -- * on Windows, expected to default to Western European enc @@ -574,7 +568,7 @@ describe('shell :!', function() it(':{range}! with powershell filter/redirect #16271 #19250', function() local screen = Screen.new(500, 8) screen:attach() - local found = helpers.set_shell_powershell(true) + local found = t.set_shell_powershell(true) insert([[ 3 1 @@ -621,12 +615,12 @@ describe('shell :!', function() } end feed('<CR>') - helpers.set_shell_powershell(true) + t.set_shell_powershell(true) feed(':4verbose %w !sort<cr>') screen:expect { any = [[Executing command: .?& { Get%-Content .* | & sort }]], } feed('<CR>') - helpers.expect_exit(command, 'qall!') + t.expect_exit(command, 'qall!') end) end) diff --git a/test/functional/vimscript/timer_spec.lua b/test/functional/vimscript/timer_spec.lua index 046d451888..2ec951448c 100644 --- a/test/functional/vimscript/timer_spec.lua +++ b/test/functional/vimscript/timer_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) local Screen = require('test.functional.ui.screen') -local feed, eq, eval, ok = helpers.feed, helpers.eq, helpers.eval, helpers.ok -local source, async_meths, run = helpers.source, helpers.async_meths, helpers.run -local clear, command, fn = helpers.clear, helpers.command, helpers.fn -local exc_exec = helpers.exc_exec -local api = helpers.api -local load_adjust = helpers.load_adjust -local retry = helpers.retry +local feed, eq, eval, ok = t.feed, t.eq, t.eval, t.ok +local source, async_meths, run = t.source, t.async_meths, t.run +local clear, command, fn = t.clear, t.command, t.fn +local exc_exec = t.exc_exec +local api = t.api +local load_adjust = t.load_adjust +local retry = t.retry describe('timers', function() before_each(function() diff --git a/test/functional/vimscript/uniq_spec.lua b/test/functional/vimscript/uniq_spec.lua index 8fd4004be4..ed87d50abf 100644 --- a/test/functional/vimscript/uniq_spec.lua +++ b/test/functional/vimscript/uniq_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local eq = helpers.eq -local clear = helpers.clear -local command = helpers.command -local exc_exec = helpers.exc_exec -local pcall_err = helpers.pcall_err +local eq = t.eq +local clear = t.clear +local command = t.command +local exc_exec = t.exc_exec +local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/vimscript/vvar_event_spec.lua b/test/functional/vimscript/vvar_event_spec.lua index 68eda05363..57c849b45a 100644 --- a/test/functional/vimscript/vvar_event_spec.lua +++ b/test/functional/vimscript/vvar_event_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq -local command = helpers.command +local t = require('test.functional.testutil')(after_each) +local clear, eval, eq = t.clear, t.eval, t.eq +local command = t.command describe('v:event', function() before_each(clear) it('is empty before any autocommand', function() diff --git a/test/functional/vimscript/wait_spec.lua b/test/functional/vimscript/wait_spec.lua index 50cdb2cfb4..15e04af6c9 100644 --- a/test/functional/vimscript/wait_spec.lua +++ b/test/functional/vimscript/wait_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) -local call = helpers.call -local clear = helpers.clear -local command = helpers.command -local eval = helpers.eval -local eq = helpers.eq -local feed = helpers.feed -local feed_command = helpers.feed_command -local next_msg = helpers.next_msg -local api = helpers.api -local source = helpers.source -local pcall_err = helpers.pcall_err +local t = require('test.functional.testutil')(after_each) +local call = t.call +local clear = t.clear +local command = t.command +local eval = t.eval +local eq = t.eq +local feed = t.feed +local feed_command = t.feed_command +local next_msg = t.next_msg +local api = t.api +local source = t.source +local pcall_err = t.pcall_err before_each(function() clear() @@ -60,7 +60,7 @@ describe('wait()', function() ]]) -- XXX: flaky (#11137) - helpers.retry(nil, nil, function() + t.retry(nil, nil, function() api.nvim_set_var('counter', 0) eq(-1, call('wait', 20, 'Count() >= 5', 99999)) end) diff --git a/test/functional/vimscript/writefile_spec.lua b/test/functional/vimscript/writefile_spec.lua index 051e3794a3..47fbd2ef1b 100644 --- a/test/functional/vimscript/writefile_spec.lua +++ b/test/functional/vimscript/writefile_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.functional.testutil')(after_each) -local mkdir = helpers.mkdir -local clear = helpers.clear -local eq = helpers.eq -local fn = helpers.fn -local api = helpers.api -local exc_exec = helpers.exc_exec -local read_file = helpers.read_file -local write_file = helpers.write_file -local pcall_err = helpers.pcall_err -local command = helpers.command +local mkdir = t.mkdir +local clear = t.clear +local eq = t.eq +local fn = t.fn +local api = t.api +local exc_exec = t.exc_exec +local read_file = t.read_file +local write_file = t.write_file +local pcall_err = t.pcall_err +local command = t.command local fname = 'Xtest-functional-eval-writefile' local dname = fname .. '.d' diff --git a/test/old/testdir/load.vim b/test/old/testdir/load.vim index 5697ee7304..139fc933c0 100644 --- a/test/old/testdir/load.vim +++ b/test/old/testdir/load.vim @@ -1,4 +1,4 @@ -" Also used by: test/functional/helpers.lua +" Also used by: test/functional/testutil.lua function! s:load_factor() abort let timeout = 200 diff --git a/test/helpers.lua b/test/testutil.lua index 3d53aa3be9..1013fa905e 100644 --- a/test/helpers.lua +++ b/test/testutil.lua @@ -16,7 +16,7 @@ local function shell_quote(str) return str end ---- @class test.helpers +--- @class test.testutil local module = { paths = Paths, } @@ -254,7 +254,7 @@ function module.pcall_err_withtrace(fn, ...) return ( errmsg - :gsub('^%.%.%./helpers%.lua:0: ', '') + :gsub('^%.%.%./testutil%.lua:0: ', '') :gsub('^Error executing lua:- ', '') :gsub('^%[string "<nvim>"%]:0: ', '') ) diff --git a/test/unit/api/private_helpers_spec.lua b/test/unit/api/private_helpers_spec.lua index 9843bd5c9e..282a2e7f8e 100644 --- a/test/unit/api/private_helpers_spec.lua +++ b/test/unit/api/private_helpers_spec.lua @@ -1,24 +1,24 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local eval_helpers = require('test.unit.eval.helpers') -local api_helpers = require('test.unit.api.helpers') - -local cimport = helpers.cimport -local NULL = helpers.NULL -local eq = helpers.eq - -local lua2typvalt = eval_helpers.lua2typvalt -local typvalt2lua = eval_helpers.typvalt2lua -local typvalt = eval_helpers.typvalt - -local nil_value = api_helpers.nil_value -local list_type = api_helpers.list_type -local int_type = api_helpers.int_type -local type_key = api_helpers.type_key -local obj2lua = api_helpers.obj2lua -local func_type = api_helpers.func_type - -local api = cimport('./src/nvim/api/private/helpers.h', './src/nvim/api/private/converter.h') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_eval = require('test.unit.eval.testutil') +local api_t = require('test.unit.api.testutil') + +local cimport = t.cimport +local NULL = t.NULL +local eq = t.eq + +local lua2typvalt = t_eval.lua2typvalt +local typvalt2lua = t_eval.typvalt2lua +local typvalt = t_eval.typvalt + +local nil_value = api_t.nil_value +local list_type = api_t.list_type +local int_type = api_t.int_type +local type_key = api_t.type_key +local obj2lua = api_t.obj2lua +local func_type = api_t.func_type + +local api = cimport('./src/nvim/api/private/t.h', './src/nvim/api/private/converter.h') describe('vim_to_object', function() local vim_to_object = function(l) diff --git a/test/unit/api/helpers.lua b/test/unit/api/testutil.lua index 23c5db43f7..2790bca085 100644 --- a/test/unit/api/helpers.lua +++ b/test/unit/api/testutil.lua @@ -1,23 +1,20 @@ -local helpers = require('test.unit.helpers')(nil) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(nil) +local t_eval = require('test.unit.eval.testutil') -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local ffi = helpers.ffi +local cimport = t.cimport +local to_cstr = t.to_cstr +local ffi = t.ffi -local list_type = eval_helpers.list_type -local dict_type = eval_helpers.dict_type -local func_type = eval_helpers.func_type -local nil_value = eval_helpers.nil_value -local int_type = eval_helpers.int_type -local flt_type = eval_helpers.flt_type -local type_key = eval_helpers.type_key +local list_type = t_eval.list_type +local dict_type = t_eval.dict_type +local func_type = t_eval.func_type +local nil_value = t_eval.nil_value +local int_type = t_eval.int_type +local flt_type = t_eval.flt_type +local type_key = t_eval.type_key -local api = cimport( - './src/nvim/api/private/defs.h', - './src/nvim/api/private/helpers.h', - './src/nvim/memory.h' -) +local api = + cimport('./src/nvim/api/private/defs.h', './src/nvim/api/private/t.h', './src/nvim/memory.h') local obj2lua diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 1ef3e97165..beedc6b5f1 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local eq = helpers.eq -local NULL = helpers.NULL +local to_cstr = t.to_cstr +local eq = t.eq +local NULL = t.NULL -local buffer = helpers.cimport('./src/nvim/buffer.h') +local buffer = t.cimport('./src/nvim/buffer.h') describe('buffer functions', function() local buflist_new = function(file, flags) diff --git a/test/unit/charset/vim_str2nr_spec.lua b/test/unit/charset/vim_str2nr_spec.lua index ad87d026e5..f83fc3b96b 100644 --- a/test/unit/charset/vim_str2nr_spec.lua +++ b/test/unit/charset/vim_str2nr_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) +local t = require('test.unit.testutil')(after_each) local bit = require('bit') -local itp = helpers.gen_itp(it) +local itp = t.gen_itp(it) -local child_call_once = helpers.child_call_once -local cimport = helpers.cimport -local ffi = helpers.ffi +local child_call_once = t.child_call_once +local cimport = t.cimport +local ffi = t.ffi local lib = cimport('./src/nvim/charset.h') diff --git a/test/unit/eval/decode_spec.lua b/test/unit/eval/decode_spec.lua index 5a8374a2a6..1f36d95473 100644 --- a/test/unit/eval/decode_spec.lua +++ b/test/unit/eval/decode_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi +local cimport = t.cimport +local eq = t.eq +local neq = t.neq +local ffi = t.ffi local decode = cimport( './src/nvim/eval/decode.h', diff --git a/test/unit/eval/encode_spec.lua b/test/unit/eval/encode_spec.lua index 498346d7cc..d0eeedf4b0 100644 --- a/test/unit/eval/encode_spec.lua +++ b/test/unit/eval/encode_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_eval = require('test.unit.eval.testutil') -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local eq = helpers.eq +local cimport = t.cimport +local to_cstr = t.to_cstr +local eq = t.eq -local list = eval_helpers.list -local lst2tbl = eval_helpers.lst2tbl -local type_key = eval_helpers.type_key -local list_type = eval_helpers.list_type -local null_string = eval_helpers.null_string +local list = t_eval.list +local lst2tbl = t_eval.lst2tbl +local type_key = t_eval.type_key +local list_type = t_eval.list_type +local null_string = t_eval.null_string local encode = cimport('./src/nvim/eval/encode.h') diff --git a/test/unit/eval/helpers.lua b/test/unit/eval/testutil.lua index 6402e1f8c9..5809877341 100644 --- a/test/unit/eval/helpers.lua +++ b/test/unit/eval/testutil.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(nil) +local t = require('test.unit.testutil')(nil) -local ptr2key = helpers.ptr2key -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local ffi = helpers.ffi -local eq = helpers.eq +local ptr2key = t.ptr2key +local cimport = t.cimport +local to_cstr = t.to_cstr +local ffi = t.ffi +local eq = t.eq local eval = cimport( './src/nvim/eval.h', @@ -142,56 +142,56 @@ local function typvalt2lua_tab_init() return end typvalt2lua_tab = { - [tonumber(eval.VAR_BOOL)] = function(t) + [tonumber(eval.VAR_BOOL)] = function(q) return ({ [tonumber(eval.kBoolVarFalse)] = false, [tonumber(eval.kBoolVarTrue)] = true, - })[tonumber(t.vval.v_bool)] + })[tonumber(q.vval.v_bool)] end, - [tonumber(eval.VAR_SPECIAL)] = function(t) + [tonumber(eval.VAR_SPECIAL)] = function(q) return ({ [tonumber(eval.kSpecialVarNull)] = nil_value, - })[tonumber(t.vval.v_special)] + })[tonumber(q.vval.v_special)] end, - [tonumber(eval.VAR_NUMBER)] = function(t) - return { [type_key] = int_type, value = tonumber(t.vval.v_number) } + [tonumber(eval.VAR_NUMBER)] = function(q) + return { [type_key] = int_type, value = tonumber(q.vval.v_number) } end, - [tonumber(eval.VAR_FLOAT)] = function(t) - return tonumber(t.vval.v_float) + [tonumber(eval.VAR_FLOAT)] = function(q) + return tonumber(q.vval.v_float) end, - [tonumber(eval.VAR_STRING)] = function(t) - local str = t.vval.v_string + [tonumber(eval.VAR_STRING)] = function(q) + local str = q.vval.v_string if str == nil then return null_string else return ffi.string(str) end end, - [tonumber(eval.VAR_LIST)] = function(t, processed) - return lst2tbl(t.vval.v_list, processed) + [tonumber(eval.VAR_LIST)] = function(q, processed) + return lst2tbl(q.vval.v_list, processed) end, - [tonumber(eval.VAR_DICT)] = function(t, processed) - return dct2tbl(t.vval.v_dict, processed) + [tonumber(eval.VAR_DICT)] = function(q, processed) + return dct2tbl(q.vval.v_dict, processed) end, - [tonumber(eval.VAR_FUNC)] = function(t, processed) - return { [type_key] = func_type, value = typvalt2lua_tab[eval.VAR_STRING](t, processed or {}) } + [tonumber(eval.VAR_FUNC)] = function(q, processed) + return { [type_key] = func_type, value = typvalt2lua_tab[eval.VAR_STRING](q, processed or {}) } end, - [tonumber(eval.VAR_PARTIAL)] = function(t, processed) - local p_key = ptr2key(t) + [tonumber(eval.VAR_PARTIAL)] = function(q, processed) + local p_key = ptr2key(q) if processed[p_key] then return processed[p_key] end - return partial2lua(t.vval.v_partial, processed) + return partial2lua(q.vval.v_partial, processed) end, } end -typvalt2lua = function(t, processed) +typvalt2lua = function(q, processed) typvalt2lua_tab_init() return ( - (typvalt2lua_tab[tonumber(t.v_type)] or function(t_inner) + (typvalt2lua_tab[tonumber(q.v_type)] or function(t_inner) assert(false, 'Converting ' .. tonumber(t_inner.v_type) .. ' was not implemented yet') - end)(t, processed or {}) + end)(q, processed or {}) ) end @@ -419,7 +419,7 @@ local function alloc_len(len, get_ptr) end end -local alloc_logging_helpers = { +local alloc_logging_t = { list = function(l) return { func = 'calloc', args = { 1, ffi.sizeof('list_T') }, ret = void(l) } end, @@ -523,7 +523,7 @@ local function tbl2callback(tbl) else assert(false) end - return ffi.gc(ffi.cast('Callback*', ret), helpers.callback_free) + return ffi.gc(ffi.cast('Callback*', ret), t.callback_free) end local function dict_watchers(d) @@ -591,7 +591,7 @@ return { list_iter = list_iter, first_di = first_di, - alloc_logging_helpers = alloc_logging_helpers, + alloc_logging_t = alloc_logging_t, list_items = list_items, dict_items = dict_items, diff --git a/test/unit/eval/tricks_spec.lua b/test/unit/eval/tricks_spec.lua index ed26fd44e4..c67bfa4fac 100644 --- a/test/unit/eval/tricks_spec.lua +++ b/test/unit/eval/tricks_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(after_each) +local t_eval = require('test.unit.eval.testutil') -local itp = helpers.gen_itp(it) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq +local cimport = t.cimport +local eq = t.eq -local eval0 = eval_helpers.eval0 +local eval0 = t_eval.eval0 local eval = cimport('./src/nvim/eval.h', './src/nvim/eval/typval.h', './src/nvim/memory.h') diff --git a/test/unit/eval/tv_clear_spec.lua b/test/unit/eval/tv_clear_spec.lua index a34cf6082a..86ddde9d7d 100644 --- a/test/unit/eval/tv_clear_spec.lua +++ b/test/unit/eval/tv_clear_spec.lua @@ -1,18 +1,18 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_eval = require('test.unit.eval.testutil') -local alloc_log_new = helpers.alloc_log_new -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq +local alloc_log_new = t.alloc_log_new +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq -local a = eval_helpers.alloc_logging_helpers -local type_key = eval_helpers.type_key -local list_type = eval_helpers.list_type -local list_items = eval_helpers.list_items -local dict_items = eval_helpers.dict_items -local lua2typvalt = eval_helpers.lua2typvalt +local a = t_eval.alloc_logging_t +local type_key = t_eval.type_key +local list_type = t_eval.list_type +local list_items = t_eval.list_items +local dict_items = t_eval.dict_items +local lua2typvalt = t_eval.lua2typvalt local lib = cimport('./src/nvim/eval/typval.h', './src/nvim/eval.h') diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua index a775bb48b4..029a6d53a4 100644 --- a/test/unit/eval/typval_spec.lua +++ b/test/unit/eval/typval_spec.lua @@ -1,45 +1,45 @@ local bit = require('bit') -local helpers = require('test.unit.helpers')(after_each) -local eval_helpers = require('test.unit.eval.helpers') - -local itp = helpers.gen_itp(it) - -local OK = helpers.OK -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local FAIL = helpers.FAIL -local NULL = helpers.NULL -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local alloc_log_new = helpers.alloc_log_new -local concat_tables = helpers.concat_tables +local t = require('test.unit.testutil')(after_each) +local t_eval = require('test.unit.eval.testutil') + +local itp = t.gen_itp(it) + +local OK = t.OK +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local FAIL = t.FAIL +local NULL = t.NULL +local cimport = t.cimport +local to_cstr = t.to_cstr +local alloc_log_new = t.alloc_log_new +local concat_tables = t.concat_tables local map = vim.tbl_map -local a = eval_helpers.alloc_logging_helpers -local int = eval_helpers.int -local list = eval_helpers.list -local dict = eval_helpers.dict -local eval0 = eval_helpers.eval0 -local lst2tbl = eval_helpers.lst2tbl -local dct2tbl = eval_helpers.dct2tbl -local typvalt = eval_helpers.typvalt -local type_key = eval_helpers.type_key -local li_alloc = eval_helpers.li_alloc -local first_di = eval_helpers.first_di -local nil_value = eval_helpers.nil_value -local func_type = eval_helpers.func_type -local null_list = eval_helpers.null_list -local null_dict = eval_helpers.null_dict -local dict_items = eval_helpers.dict_items -local list_items = eval_helpers.list_items -local empty_list = eval_helpers.empty_list -local lua2typvalt = eval_helpers.lua2typvalt -local typvalt2lua = eval_helpers.typvalt2lua -local null_string = eval_helpers.null_string -local callback2tbl = eval_helpers.callback2tbl -local tbl2callback = eval_helpers.tbl2callback -local dict_watchers = eval_helpers.dict_watchers +local a = t_eval.alloc_logging_t +local int = t_eval.int +local list = t_eval.list +local dict = t_eval.dict +local eval0 = t_eval.eval0 +local lst2tbl = t_eval.lst2tbl +local dct2tbl = t_eval.dct2tbl +local typvalt = t_eval.typvalt +local type_key = t_eval.type_key +local li_alloc = t_eval.li_alloc +local first_di = t_eval.first_di +local nil_value = t_eval.nil_value +local func_type = t_eval.func_type +local null_list = t_eval.null_list +local null_dict = t_eval.null_dict +local dict_items = t_eval.dict_items +local list_items = t_eval.list_items +local empty_list = t_eval.empty_list +local lua2typvalt = t_eval.lua2typvalt +local typvalt2lua = t_eval.typvalt2lua +local null_string = t_eval.null_string +local callback2tbl = t_eval.callback2tbl +local tbl2callback = t_eval.tbl2callback +local dict_watchers = t_eval.dict_watchers local lib = cimport( './src/nvim/eval/typval.h', diff --git a/test/unit/fileio_spec.lua b/test/unit/fileio_spec.lua index 1284f84222..55332cee87 100644 --- a/test/unit/fileio_spec.lua +++ b/test/unit/fileio_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) ---{:cimport, :internalize, :eq, :neq, :ffi, :lib, :cstr, :to_cstr} = require 'test.unit.helpers' +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +--{:cimport, :internalize, :eq, :neq, :ffi, :lib, :cstr, :to_cstr} = require 'test.unit.testutil' -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr +local NULL = t.NULL -local fileio = helpers.cimport('./src/nvim/fileio.h') +local fileio = t.cimport('./src/nvim/fileio.h') describe('file_pat functions', function() describe('file_pat_to_reg_pat', function() diff --git a/test/unit/garray_spec.lua b/test/unit/garray_spec.lua index 0f947c42b8..f0b991a051 100644 --- a/test/unit/garray_spec.lua +++ b/test/unit/garray_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local internalize = helpers.internalize -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local internalize = t.internalize +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local to_cstr = t.to_cstr +local NULL = t.NULL local garray = cimport('./src/nvim/garray.h') diff --git a/test/unit/indent_spec.lua b/test/unit/indent_spec.lua index 7902918c54..8fa848b086 100644 --- a/test/unit/indent_spec.lua +++ b/test/unit/indent_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local ffi = helpers.ffi -local eq = helpers.eq +local to_cstr = t.to_cstr +local ffi = t.ffi +local eq = t.eq -local indent = helpers.cimport('./src/nvim/indent.h') -local globals = helpers.cimport('./src/nvim/globals.h') +local indent = t.cimport('./src/nvim/indent.h') +local globals = t.cimport('./src/nvim/globals.h') describe('get_sts_value', function() itp([[returns 'softtabstop' when it is non-negative]], function() diff --git a/test/unit/keycodes_spec.lua b/test/unit/keycodes_spec.lua index 4a81c62ac1..7c8fd47c21 100644 --- a/test/unit/keycodes_spec.lua +++ b/test/unit/keycodes_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq -local neq = helpers.neq +local ffi = t.ffi +local eq = t.eq +local neq = t.neq -local keycodes = helpers.cimport('./src/nvim/keycodes.h') -local NULL = helpers.NULL +local keycodes = t.cimport('./src/nvim/keycodes.h') +local NULL = t.NULL describe('keycodes.c', function() describe('find_special_key()', function() diff --git a/test/unit/marktree_spec.lua b/test/unit/marktree_spec.lua index b0a861727d..3e6081a078 100644 --- a/test/unit/marktree_spec.lua +++ b/test/unit/marktree_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq -local ok = helpers.ok +local ffi = t.ffi +local eq = t.eq +local ok = t.ok -local lib = helpers.cimport('./src/nvim/marktree.h') +local lib = t.cimport('./src/nvim/marktree.h') -local function tablelength(t) +local function tablelength(tbl) local count = 0 - for _ in pairs(t) do + for _ in pairs(tbl) do count = count + 1 end return count @@ -460,7 +460,7 @@ describe('marktree', function() local ids = {} -- too much overhead on ASAN - local size_factor = helpers.is_asan() and 3 or 10 + local size_factor = t.is_asan() and 3 or 10 local at_row = {} for i = 1, 10 do @@ -528,7 +528,7 @@ describe('marktree', function() local tree = ffi.new('MarkTree[1]') -- zero initialized by luajit -- too much overhead on ASAN - local size_factor = helpers.is_asan() and 3 or 10 + local size_factor = t.is_asan() and 3 or 10 local at_row = {} for i = 1, 10 do diff --git a/test/unit/mbyte_spec.lua b/test/unit/mbyte_spec.lua index 00a8c06ceb..1a28f9c43d 100644 --- a/test/unit/mbyte_spec.lua +++ b/test/unit/mbyte_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq +local ffi = t.ffi +local eq = t.eq -local lib = helpers.cimport('./src/nvim/mbyte.h', './src/nvim/charset.h', './src/nvim/grid.h') +local lib = t.cimport('./src/nvim/mbyte.h', './src/nvim/charset.h', './src/nvim/grid.h') describe('mbyte', function() -- Convert from bytes to string @@ -205,7 +205,7 @@ describe('mbyte', function() end) describe('utf_cp_bounds_len', function() - local to_cstr = helpers.to_cstr + local to_cstr = t.to_cstr local tests = { { diff --git a/test/unit/memory_spec.lua b/test/unit/memory_spec.lua index 8be55fdbf3..fb49bdf8e5 100644 --- a/test/unit/memory_spec.lua +++ b/test/unit/memory_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local cstr = helpers.cstr -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr +local cimport = t.cimport +local cstr = t.cstr +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr local cimp = cimport('stdlib.h', './src/nvim/memory.h') diff --git a/test/unit/message_spec.lua b/test/unit/message_spec.lua index 71aa74d90d..5653f8ee5b 100644 --- a/test/unit/message_spec.lua +++ b/test/unit/message_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq -local to_cstr = helpers.to_cstr +local ffi = t.ffi +local eq = t.eq +local to_cstr = t.to_cstr -local cimp = helpers.cimport('./src/nvim/message.h', './src/nvim/memory.h', './src/nvim/strings.h') +local cimp = t.cimport('./src/nvim/message.h', './src/nvim/memory.h', './src/nvim/strings.h') describe('trunc_string', function() local buflen = 40 @@ -33,26 +33,26 @@ describe('trunc_string', function() { ['desc'] = 'by copy', ['func'] = test_copy }, } - for _, t in ipairs(permutations) do - describe('populates buf ' .. t.desc, function() + for _, q in ipairs(permutations) do + describe('populates buf ' .. q.desc, function() itp('with a small string', function() - t.func('text', 'text') + q.func('text', 'text') end) itp('with a medium string', function() - t.func('a short text', 'a short text') + q.func('a short text', 'a short text') end) itp('with a string of length == 1/2 room', function() - t.func('a text that fits', 'a text that fits', 34) + q.func('a text that fits', 'a text that fits', 34) end) itp('with a string exactly the truncate size', function() - t.func('a text tha just fits', 'a text tha just fits') + q.func('a text tha just fits', 'a text tha just fits') end) itp('with a string that must be truncated', function() - t.func('a text that nott fits', 'a text t...nott fits') + q.func('a text that nott fits', 'a text t...nott fits') end) end) end diff --git a/test/unit/msgpack_spec.lua b/test/unit/msgpack_spec.lua index f9fde00a85..0bebbef141 100644 --- a/test/unit/msgpack_spec.lua +++ b/test/unit/msgpack_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local cimport = helpers.cimport -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local cimport = t.cimport +local itp = t.gen_itp(it) local lib = cimport('./src/nvim/msgpack_rpc/unpacker.h', './src/nvim/memory.h') -local ffi = helpers.ffi -local eq = helpers.eq -local to_cstr = helpers.to_cstr +local ffi = t.ffi +local eq = t.eq +local to_cstr = t.to_cstr --- @class Unpacker --- @field read_ptr ffi.cdata* diff --git a/test/unit/multiqueue_spec.lua b/test/unit/multiqueue_spec.lua index f6d11ebed0..0866bc1f0c 100644 --- a/test/unit/multiqueue_spec.lua +++ b/test/unit/multiqueue_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local child_call_once = helpers.child_call_once -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq +local child_call_once = t.child_call_once +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq local multiqueue = cimport('./test/unit/fixtures/multiqueue.h') diff --git a/test/unit/optionstr_spec.lua b/test/unit/optionstr_spec.lua index 7666db910e..37fe4a3a3b 100644 --- a/test/unit/optionstr_spec.lua +++ b/test/unit/optionstr_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local eq = helpers.eq +local to_cstr = t.to_cstr +local eq = t.eq -local optionstr = helpers.cimport('./src/nvim/optionstr.h') +local optionstr = t.cimport('./src/nvim/optionstr.h') local check_ff_value = function(ff) return optionstr.check_ff_value(to_cstr(ff)) diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index 310201b8c3..d0231b2e2b 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local NULL = t.NULL local OK = 0 local cimp = cimport('./src/nvim/os/os.h') diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua index 617141fd3a..d748a6d306 100644 --- a/test/unit/os/fileio_spec.lua +++ b/test/unit/os/fileio_spec.lua @@ -1,13 +1,13 @@ local uv = vim.uv -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local eq = helpers.eq -local ffi = helpers.ffi -local cimport = helpers.cimport -local cppimport = helpers.cppimport -local mkdir = helpers.mkdir +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local eq = t.eq +local ffi = t.ffi +local cimport = t.cimport +local cppimport = t.cppimport +local mkdir = t.mkdir local m = cimport('./src/nvim/os/os.h', './src/nvim/os/fileio.h') cppimport('fcntl.h') diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index c15cd12fef..e866a1b5c3 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -1,22 +1,22 @@ local uv = vim.uv local bit = require('bit') -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local cppimport = helpers.cppimport -local internalize = helpers.internalize -local ok = helpers.ok -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local OK = helpers.OK -local FAIL = helpers.FAIL -local NULL = helpers.NULL -local mkdir = helpers.mkdir +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local cppimport = t.cppimport +local internalize = t.internalize +local ok = t.ok +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local OK = t.OK +local FAIL = t.FAIL +local NULL = t.NULL +local mkdir = t.mkdir local endswith = vim.endswith local NODE_NORMAL = 0 diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua index 05f965585a..fd0a6336b0 100644 --- a/test/unit/os/shell_spec.lua +++ b/test/unit/os/shell_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local cimported = helpers.cimport( +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local cimported = t.cimport( './src/nvim/os/shell.h', './src/nvim/option_vars.h', './src/nvim/main.h', './src/nvim/memory.h' ) -local ffi, eq = helpers.ffi, helpers.eq -local intern = helpers.internalize -local to_cstr = helpers.to_cstr +local ffi, eq = t.ffi, t.eq +local intern = t.internalize +local to_cstr = t.to_cstr local NULL = ffi.cast('void *', 0) describe('shell functions', function() diff --git a/test/unit/os/users_spec.lua b/test/unit/os/users_spec.lua index 679e76fae1..cf81b25a44 100644 --- a/test/unit/os/users_spec.lua +++ b/test/unit/os/users_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local ffi = helpers.ffi -local lib = helpers.lib -local NULL = helpers.NULL -local OK = helpers.OK -local FAIL = helpers.FAIL +local cimport = t.cimport +local eq = t.eq +local ffi = t.ffi +local lib = t.lib +local NULL = t.NULL +local OK = t.OK +local FAIL = t.FAIL local users = cimport('./src/nvim/os/os.h', 'unistd.h') diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index c564ec119e..0c94201dfa 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -1,17 +1,17 @@ local uv = vim.uv -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL -local OK = helpers.OK -local FAIL = helpers.FAIL -local mkdir = helpers.mkdir +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local NULL = t.NULL +local OK = t.OK +local FAIL = t.FAIL +local mkdir = t.mkdir cimport('string.h') local cimp = cimport('./src/nvim/os/os.h', './src/nvim/path.h') @@ -380,8 +380,8 @@ describe('path.c', function() return buf, result end - local function get_buf_len(s, t) - return math.max(string.len(s), string.len(t)) + 1 + local function get_buf_len(s, q) + return math.max(string.len(s), string.len(q)) + 1 end itp('fails if given filename is NULL', function() diff --git a/test/unit/preload.lua b/test/unit/preload.lua index c2d051d98a..896d07b9cd 100644 --- a/test/unit/preload.lua +++ b/test/unit/preload.lua @@ -2,5 +2,5 @@ -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. local ffi = require('ffi') -local helpers = require('test.unit.helpers')(nil) +local t = require('test.unit.testutil')(nil) local preprocess = require('test.unit.preprocess') diff --git a/test/unit/preprocess.lua b/test/unit/preprocess.lua index 6294114e1e..8d481df0d0 100644 --- a/test/unit/preprocess.lua +++ b/test/unit/preprocess.lua @@ -2,10 +2,10 @@ -- windows, will probably need quite a bit of adjustment to run there. local ffi = require('ffi') -local global_helpers = require('test.helpers') +local global_t = require('test.testutil') -local argss_to_cmd = global_helpers.argss_to_cmd -local repeated_read_cmd = global_helpers.repeated_read_cmd +local argss_to_cmd = global_t.argss_to_cmd +local repeated_read_cmd = global_t.repeated_read_cmd --- @alias Compiler {path: string[], type: string} diff --git a/test/unit/profile_spec.lua b/test/unit/profile_spec.lua index c7dc7db189..79d32c3a69 100644 --- a/test/unit/profile_spec.lua +++ b/test/unit/profile_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq -local neq = helpers.neq +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq +local neq = t.neq local prof = cimport('./src/nvim/profile.h') @@ -13,13 +13,13 @@ local function split(inputstr, sep) sep = '%s' end - local t, i = {}, 1 + local q, i = {}, 1 for str in string.gmatch(inputstr, '([^' .. sep .. ']+)') do - t[i] = str + q[i] = str i = i + 1 end - return t + return q end local function trim(s) @@ -72,8 +72,8 @@ describe('profiling related functions', function() local function profile_start() return prof.profile_start() end - local function profile_end(t) - return prof.profile_end(t) + local function profile_end(q) + return prof.profile_end(q) end local function profile_zero() return prof.profile_zero() @@ -81,8 +81,8 @@ describe('profiling related functions', function() local function profile_setlimit(ms) return prof.profile_setlimit(ms) end - local function profile_passed_limit(t) - return prof.profile_passed_limit(t) + local function profile_passed_limit(q) + return prof.profile_passed_limit(q) end local function profile_add(t1, t2) return prof.profile_add(t1, t2) @@ -90,8 +90,8 @@ describe('profiling related functions', function() local function profile_sub(t1, t2) return prof.profile_sub(t1, t2) end - local function profile_divide(t, cnt) - return prof.profile_divide(t, cnt) + local function profile_divide(q, cnt) + return prof.profile_divide(q, cnt) end local function profile_cmp(t1, t2) return prof.profile_cmp(t1, t2) @@ -99,12 +99,12 @@ describe('profiling related functions', function() local function profile_equal(t1, t2) return prof.profile_equal(t1, t2) end - local function profile_msg(t) - return ffi.string(prof.profile_msg(t)) + local function profile_msg(q) + return ffi.string(prof.profile_msg(q)) end - local function toseconds(t) -- luacheck: ignore - local str = trim(profile_msg(t)) + local function toseconds(q) -- luacheck: ignore + local str = trim(profile_msg(q)) local spl = split(str, '.') local s, us = spl[1], spl[2] return tonumber(s) + tonumber(us) / 1000000 diff --git a/test/unit/rbuffer_spec.lua b/test/unit/rbuffer_spec.lua index 328e5b93da..4b2d64cd48 100644 --- a/test/unit/rbuffer_spec.lua +++ b/test/unit/rbuffer_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local eq = helpers.eq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local child_call_once = helpers.child_call_once +local eq = t.eq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local child_call_once = t.child_call_once -local rbuffer = helpers.cimport('./test/unit/fixtures/rbuffer.h') +local rbuffer = t.cimport('./test/unit/fixtures/rbuffer.h') describe('rbuffer functions', function() local capacity = 16 diff --git a/test/unit/search_spec.lua b/test/unit/search_spec.lua index efe49f974a..4572beaae0 100644 --- a/test/unit/search_spec.lua +++ b/test/unit/search_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local eq = helpers.eq +local to_cstr = t.to_cstr +local eq = t.eq -local search = helpers.cimport('./src/nvim/search.h') -local globals = helpers.cimport('./src/nvim/globals.h') -local ffi = helpers.ffi +local search = t.cimport('./src/nvim/search.h') +local globals = t.cimport('./src/nvim/globals.h') +local ffi = t.ffi itp('pat_has_uppercase', function() -- works on empty string @@ -42,7 +42,7 @@ describe('search_regcomp', function() end local get_search_pat = function() - return helpers.internalize(search.get_search_pat()) + return t.internalize(search.get_search_pat()) end itp('accepts regexp pattern with invalid utf', function() diff --git a/test/unit/statusline_spec.lua b/test/unit/statusline_spec.lua index 83ba4176c5..41afa3c897 100644 --- a/test/unit/statusline_spec.lua +++ b/test/unit/statusline_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local get_str = helpers.ffi.string -local eq = helpers.eq -local NULL = helpers.NULL +local to_cstr = t.to_cstr +local get_str = t.ffi.string +local eq = t.eq +local NULL = t.NULL -local buffer = helpers.cimport('./src/nvim/buffer.h') -local globals = helpers.cimport('./src/nvim/globals.h') -local stl = helpers.cimport('./src/nvim/statusline.h') -local grid = helpers.cimport('./src/nvim/grid.h') +local buffer = t.cimport('./src/nvim/buffer.h') +local globals = t.cimport('./src/nvim/globals.h') +local stl = t.cimport('./src/nvim/statusline.h') +local grid = t.cimport('./src/nvim/grid.h') describe('build_stl_str_hl', function() local buffer_byte_size = 100 diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index eea669c964..e686998e84 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr +local cimport = t.cimport +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr local strings = cimport('stdlib.h', './src/nvim/strings.h', './src/nvim/memory.h') @@ -261,7 +261,7 @@ end) describe('reverse_text', function() local reverse_text = function(str) - return helpers.internalize(strings.reverse_text(to_cstr(str))) + return t.internalize(strings.reverse_text(to_cstr(str))) end itp('handles empty string', function() diff --git a/test/unit/tempfile_spec.lua b/test/unit/tempfile_spec.lua index bb0e56d640..3308eaebb2 100644 --- a/test/unit/tempfile_spec.lua +++ b/test/unit/tempfile_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local eq = helpers.eq -local neq = helpers.neq -local cimport = helpers.cimport -local child_call_once = helpers.child_call_once -local child_cleanup_once = helpers.child_cleanup_once +local eq = t.eq +local neq = t.neq +local cimport = t.cimport +local child_call_once = t.child_call_once +local child_cleanup_once = t.child_cleanup_once local lib = cimport('./src/nvim/os/os.h', './src/nvim/fileio.h') @@ -19,7 +19,7 @@ describe('tempfile related functions', function() end) local vim_gettempdir = function() - return helpers.ffi.string(lib.vim_gettempdir()) + return t.ffi.string(lib.vim_gettempdir()) end describe('vim_gettempdir', function() @@ -28,7 +28,7 @@ describe('tempfile related functions', function() assert.True(dir ~= nil and dir:len() > 0) -- os_file_is_writable returns 2 for a directory which we have rights -- to write into. - eq(2, lib.os_file_is_writable(helpers.to_cstr(dir))) + eq(2, lib.os_file_is_writable(t.to_cstr(dir))) for entry in vim.fs.dir(dir) do assert.True(entry == '.' or entry == '..') end @@ -41,7 +41,7 @@ describe('tempfile related functions', function() describe('vim_tempname', function() local vim_tempname = function() - return helpers.ffi.string(lib.vim_tempname()) + return t.ffi.string(lib.vim_tempname()) end itp('generate name of non-existing file', function() diff --git a/test/unit/testtest_spec.lua b/test/unit/testtest_spec.lua index d2f3632b6f..79f29f4e54 100644 --- a/test/unit/testtest_spec.lua +++ b/test/unit/testtest_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.unit.helpers')(after_each) +local t = require('test.unit.testutil')(after_each) local assert = require('luassert') -local itp = helpers.gen_itp(it) +local itp = t.gen_itp(it) -local sc = helpers.sc +local sc = t.sc -- All of the below tests must fail. Check how exactly they fail. if os.getenv('NVIM_TEST_RUN_TESTTEST') ~= '1' then diff --git a/test/unit/helpers.lua b/test/unit/testutil.lua index be48f777e8..c1ba1f6e97 100644 --- a/test/unit/helpers.lua +++ b/test/unit/testutil.lua @@ -2,16 +2,16 @@ local ffi = require('ffi') local formatc = require('test.unit.formatc') local Set = require('test.unit.set') local Preprocess = require('test.unit.preprocess') -local global_helpers = require('test.helpers') -local paths = global_helpers.paths +local t_global = require('test.testutil') +local paths = t_global.paths local assert = require('luassert') local say = require('say') -local check_cores = global_helpers.check_cores -local dedent = global_helpers.dedent -local neq = global_helpers.neq +local check_cores = t_global.check_cores +local dedent = t_global.dedent +local neq = t_global.neq local map = vim.tbl_map -local eq = global_helpers.eq +local eq = t_global.eq local trim = vim.trim -- add some standard header locations @@ -873,7 +873,7 @@ local function is_asan() end end ---- @class test.unit.helpers.module +--- @class test.unit.testutil.module local module = { cimport = cimport, cppimport = cppimport, @@ -903,8 +903,8 @@ local module = { debug_log = debug_log, is_asan = is_asan, } ---- @class test.unit.helpers: test.unit.helpers.module, test.helpers -module = vim.tbl_extend('error', module, global_helpers) +--- @class test.unit.testutil: test.unit.testutil.module, test.testutil +module = vim.tbl_extend('error', module, t_global) return function() return module diff --git a/test/unit/undo_spec.lua b/test/unit/undo_spec.lua index 0e2f38a8c8..847ac7789a 100644 --- a/test/unit/undo_spec.lua +++ b/test/unit/undo_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) local uv = vim.uv -local child_call_once = helpers.child_call_once +local child_call_once = t.child_call_once local sleep = uv.sleep -local ffi = helpers.ffi -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local neq = helpers.neq -local eq = helpers.eq -local mkdir = helpers.mkdir +local ffi = t.ffi +local cimport = t.cimport +local to_cstr = t.to_cstr +local neq = t.neq +local eq = t.eq +local mkdir = t.mkdir local options = cimport('./src/nvim/option_vars.h') local undo = cimport('./src/nvim/undo.h') @@ -151,12 +151,12 @@ describe('u_write_undo', function() local file_contents = 'testing permissions' -- Write a text file where the undofile should go local correct_name = ffi.string(undo.u_get_undo_file_name(file_buffer.b_ffname, false)) - helpers.write_file(correct_name, file_contents, true, false) + t.write_file(correct_name, file_contents, true, false) -- Call with `forceit`. u_write_undo(correct_name, true, file_buffer, buffer_hash) - local undo_file_contents = helpers.read_file(correct_name) + local undo_file_contents = t.read_file(correct_name) neq(file_contents, undo_file_contents) local success, deletion_err = os.remove(correct_name) -- delete the file now that we're done with it. diff --git a/test/unit/viml/expressions/lexer_spec.lua b/test/unit/viml/expressions/lexer_spec.lua index 96052a5ce1..9b2ad0a84b 100644 --- a/test/unit/viml/expressions/lexer_spec.lua +++ b/test/unit/viml/expressions/lexer_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local viml_helpers = require('test.unit.viml.helpers') - -local child_call_once = helpers.child_call_once -local conv_enum = helpers.conv_enum -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq -local shallowcopy = helpers.shallowcopy -local intchar2lua = helpers.intchar2lua - -local conv_ccs = viml_helpers.conv_ccs -local new_pstate = viml_helpers.new_pstate -local conv_cmp_type = viml_helpers.conv_cmp_type -local pstate_set_str = viml_helpers.pstate_set_str -local conv_expr_asgn_type = viml_helpers.conv_expr_asgn_type +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_viml = require('test.unit.viml.testutil') + +local child_call_once = t.child_call_once +local conv_enum = t.conv_enum +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq +local shallowcopy = t.shallowcopy +local intchar2lua = t.intchar2lua + +local conv_ccs = t_viml.conv_ccs +local new_pstate = t_viml.new_pstate +local conv_cmp_type = t_viml.conv_cmp_type +local pstate_set_str = t_viml.pstate_set_str +local conv_expr_asgn_type = t_viml.conv_expr_asgn_type local lib = cimport('./src/nvim/viml/parser/expressions.h') diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua index c7d3f8532f..74f2a120bf 100644 --- a/test/unit/viml/expressions/parser_spec.lua +++ b/test/unit/viml/expressions/parser_spec.lua @@ -1,29 +1,29 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local viml_helpers = require('test.unit.viml.helpers') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_viml = require('test.unit.viml.testutil') -local make_enum_conv_tab = helpers.make_enum_conv_tab -local child_call_once = helpers.child_call_once -local alloc_log_new = helpers.alloc_log_new -local kvi_destroy = helpers.kvi_destroy -local conv_enum = helpers.conv_enum -local debug_log = helpers.debug_log -local ptr2key = helpers.ptr2key -local cimport = helpers.cimport -local ffi = helpers.ffi -local neq = helpers.neq -local eq = helpers.eq -local mergedicts_copy = helpers.mergedicts_copy +local make_enum_conv_tab = t.make_enum_conv_tab +local child_call_once = t.child_call_once +local alloc_log_new = t.alloc_log_new +local kvi_destroy = t.kvi_destroy +local conv_enum = t.conv_enum +local debug_log = t.debug_log +local ptr2key = t.ptr2key +local cimport = t.cimport +local ffi = t.ffi +local neq = t.neq +local eq = t.eq +local mergedicts_copy = t.mergedicts_copy local format_string = require('test.format_string').format_string local format_luav = require('test.format_string').format_luav -local intchar2lua = helpers.intchar2lua -local dictdiff = helpers.dictdiff +local intchar2lua = t.intchar2lua +local dictdiff = t.dictdiff -local conv_ccs = viml_helpers.conv_ccs -local new_pstate = viml_helpers.new_pstate -local conv_cmp_type = viml_helpers.conv_cmp_type -local pstate_set_str = viml_helpers.pstate_set_str -local conv_expr_asgn_type = viml_helpers.conv_expr_asgn_type +local conv_ccs = t_viml.conv_ccs +local new_pstate = t_viml.new_pstate +local conv_cmp_type = t_viml.conv_cmp_type +local pstate_set_str = t_viml.pstate_set_str +local conv_expr_asgn_type = t_viml.conv_expr_asgn_type local lib = cimport('./src/nvim/viml/parser/expressions.h', './src/nvim/syntax.h') diff --git a/test/unit/viml/helpers.lua b/test/unit/viml/testutil.lua index 92661e3027..7046cedb47 100644 --- a/test/unit/viml/helpers.lua +++ b/test/unit/viml/testutil.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(nil) +local t = require('test.unit.testutil')(nil) -local ffi = helpers.ffi -local cimport = helpers.cimport -local kvi_new = helpers.kvi_new -local kvi_init = helpers.kvi_init -local conv_enum = helpers.conv_enum -local make_enum_conv_tab = helpers.make_enum_conv_tab +local ffi = t.ffi +local cimport = t.cimport +local kvi_new = t.kvi_new +local kvi_init = t.kvi_init +local conv_enum = t.conv_enum +local make_enum_conv_tab = t.make_enum_conv_tab local lib = cimport('./src/nvim/viml/parser/expressions.h') |