aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-04-08 11:03:20 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-04-08 22:51:00 +0200
commit7035125b2b26aa68fcfb7cda39377ac79926a0f9 (patch)
treed194a3556a367b42505f9e7d26637e7cb3674928 /test/functional/options
parent978962f9a00ce75216d2c36b79397ef3d2b54096 (diff)
downloadrneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.gz
rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.bz2
rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.zip
test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
Diffstat (limited to 'test/functional/options')
-rw-r--r--test/functional/options/autochdir_spec.lua18
-rw-r--r--test/functional/options/chars_spec.lua16
-rw-r--r--test/functional/options/cursorbind_spec.lua10
-rw-r--r--test/functional/options/defaults_spec.lua44
-rw-r--r--test/functional/options/keymap_spec.lua10
-rw-r--r--test/functional/options/modified_spec.lua8
-rw-r--r--test/functional/options/mousescroll_spec.lua20
-rw-r--r--test/functional/options/num_options_spec.lua5
-rw-r--r--test/functional/options/shortmess_spec.lua12
-rw-r--r--test/functional/options/tabstop_spec.lua8
-rw-r--r--test/functional/options/winfixbuf_spec.lua6
11 files changed, 78 insertions, 79 deletions
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()