test: improve test conventions

Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
This commit is contained in:
dundargoc
2024-04-20 17:44:13 +02:00
committed by dundargoc
parent c5af5c0b9a
commit 052498ed42
444 changed files with 3459 additions and 3131 deletions

View File

@@ -1,8 +1,10 @@
local t = require('test.functional.testutil')()
local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local clear, api = t.clear, t.api
local clear, api = n.clear, n.api
local eq = t.eq
local command = t.command
local command = n.command
describe('ui/cursor', function()
local screen
@@ -213,8 +215,8 @@ describe('ui/cursor', function()
}
-- Change the cursor style.
t.command('hi Cursor guibg=DarkGray')
t.command(
n.command('hi Cursor guibg=DarkGray')
n.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 +262,8 @@ describe('ui/cursor', function()
end)
-- Change hl groups only, should update the styles
t.command('hi Cursor guibg=Red')
t.command('hi lCursor guibg=Green')
n.command('hi Cursor guibg=Red')
n.command('hi lCursor guibg=Green')
-- Update the expected values.
for _, m in ipairs(expected_mode_info) do
@@ -280,7 +282,7 @@ describe('ui/cursor', function()
end)
-- update the highlight again to hide cursor
t.command('hi Cursor blend=100')
n.command('hi Cursor blend=100')
for _, m in ipairs(expected_mode_info) do
if m.hl_id then