mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
test(tui_spec): small consistency fixes (#25332)
- Make indent consistent. - Remove outdated "Only single integration test" comment. - Don't use setup() as function name as it's used by busted.
This commit is contained in:
@@ -29,7 +29,7 @@ local spawn_argv = helpers.spawn_argv
|
||||
local set_session = helpers.set_session
|
||||
local write_file = helpers.write_file
|
||||
|
||||
if helpers.skip(helpers.is_os('win')) then return end
|
||||
if helpers.skip(is_os('win')) then return end
|
||||
|
||||
describe('TUI', function()
|
||||
local screen
|
||||
@@ -67,8 +67,7 @@ describe('TUI', function()
|
||||
local function expect_child_buf_lines(expected)
|
||||
assert(type({}) == type(expected))
|
||||
retry(nil, nil, function()
|
||||
local _, buflines = child_session:request(
|
||||
'nvim_buf_get_lines', 0, 0, -1, false)
|
||||
local _, buflines = child_session:request('nvim_buf_get_lines', 0, 0, -1, false)
|
||||
eq(expected, buflines)
|
||||
end)
|
||||
end
|
||||
@@ -949,8 +948,7 @@ describe('TUI', function()
|
||||
]])
|
||||
-- Dot-repeat/redo.
|
||||
feed_data('2.')
|
||||
expect_child_buf_lines(
|
||||
{'"pasted from terminapasted from terminalpasted from terminall"'})
|
||||
expect_child_buf_lines({'"pasted from terminapasted from terminalpasted from terminall"'})
|
||||
screen:expect([[
|
||||
"pasted from terminapasted from terminalpasted fro|
|
||||
m termina{1:l}l" |
|
||||
@@ -1071,8 +1069,7 @@ describe('TUI', function()
|
||||
screen:expect{grid=expected_grid1, attr_ids=expected_attr}
|
||||
-- Dot-repeat/redo.
|
||||
feed_data('.')
|
||||
screen:expect{
|
||||
grid=[[
|
||||
screen:expect{grid=[[
|
||||
ESC:{11:^[} / CR: |
|
||||
xline 1 |
|
||||
ESC:{11:^[} / CR: |
|
||||
@@ -1080,8 +1077,7 @@ describe('TUI', function()
|
||||
{5:[No Name] [+] 5,1 Bot}|
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
attr_ids=expected_attr}
|
||||
]], attr_ids=expected_attr}
|
||||
-- Undo.
|
||||
feed_data('u')
|
||||
expect_child_buf_lines(expected_crlf)
|
||||
@@ -1368,8 +1364,7 @@ describe('TUI', function()
|
||||
{5:[No Name] [+] }|
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
attr_ids={
|
||||
]], attr_ids={
|
||||
[1] = {reverse = true},
|
||||
[2] = {background = tonumber('0x00000b')},
|
||||
[3] = {bold = true},
|
||||
@@ -1639,8 +1634,8 @@ describe('TUI', function()
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]]
|
||||
-- When grid assumes "℃" to be double-width but host terminal assumes it to be single-width, the
|
||||
-- second cell of "℃" is a space and the attributes of the "℃" are applied to it.
|
||||
-- When grid assumes "℃" to be double-width but host terminal assumes it to be single-width,
|
||||
-- the second cell of "℃" is a space and the attributes of the "℃" are applied to it.
|
||||
local doublewidth_screen = [[
|
||||
{13:℃}{12: ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ }|
|
||||
{12:℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ }|
|
||||
@@ -1662,7 +1657,7 @@ describe('TUI', function()
|
||||
end)
|
||||
|
||||
it('draws correctly when cursor_address overflows #21643', function()
|
||||
helpers.skip(helpers.is_os('mac'), 'FIXME: crashes/errors on macOS')
|
||||
helpers.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)})
|
||||
@@ -2173,7 +2168,7 @@ describe("TUI 't_Co' (terminal colors)", function()
|
||||
local screen
|
||||
|
||||
local function assert_term_colors(term, colorterm, maxcolors)
|
||||
helpers.clear({env={TERM=term}, args={}})
|
||||
clear({env={TERM=term}, args={}})
|
||||
-- This is ugly because :term/termopen() forces TERM=xterm-256color.
|
||||
-- TODO: Revisit this after jobstart/termopen accept `env` dict.
|
||||
screen = thelpers.screen_setup(0, string.format(
|
||||
@@ -2538,19 +2533,18 @@ describe("TUI", function()
|
||||
|
||||
end)
|
||||
|
||||
-- See test/unit/tui_spec.lua for unit tests.
|
||||
describe('TUI bg color', function()
|
||||
local screen
|
||||
|
||||
local function setup()
|
||||
-- Only single integration test.
|
||||
-- See test/unit/tui_spec.lua for unit tests.
|
||||
local function setup_bg_test()
|
||||
clear()
|
||||
screen = thelpers.screen_setup(0, '["'..nvim_prog
|
||||
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile", '
|
||||
..'"-c", "autocmd OptionSet background echo \\"did OptionSet, yay!\\""]')
|
||||
end
|
||||
|
||||
before_each(setup)
|
||||
before_each(setup_bg_test)
|
||||
|
||||
it('triggers OptionSet event on unsplit terminal-response', function()
|
||||
screen:expect([[
|
||||
@@ -2568,7 +2562,7 @@ describe('TUI bg color', function()
|
||||
feed_data(':echo "new_bg=".&background\n')
|
||||
screen:expect{any='new_bg=light'}
|
||||
|
||||
setup()
|
||||
setup_bg_test()
|
||||
screen:expect([[
|
||||
{1: } |
|
||||
{4:~ }|
|
||||
@@ -2603,7 +2597,7 @@ describe('TUI bg color', function()
|
||||
feed_data(':echo "new_bg=".&background\n')
|
||||
screen:expect{any='new_bg=light'}
|
||||
|
||||
setup()
|
||||
setup_bg_test()
|
||||
screen:expect([[
|
||||
{1: } |
|
||||
{4:~ }|
|
||||
@@ -2638,7 +2632,7 @@ describe('TUI bg color', function()
|
||||
feed_data(':echo "new_bg=".&background\n')
|
||||
screen:expect{any='new_bg=dark'}
|
||||
|
||||
setup()
|
||||
setup_bg_test()
|
||||
screen:expect([[
|
||||
{1: } |
|
||||
{4:~ }|
|
||||
@@ -2726,7 +2720,7 @@ describe("TUI as a client", function()
|
||||
end)
|
||||
|
||||
it("connects to remote instance (--headless)", function()
|
||||
local server = helpers.spawn_argv(false) -- equivalent to clear()
|
||||
local server = spawn_argv(false) -- equivalent to clear()
|
||||
local client_super = spawn_argv(true)
|
||||
|
||||
set_session(server)
|
||||
@@ -2734,11 +2728,11 @@ describe("TUI as a client", function()
|
||||
server:request('nvim_input', 'iHalloj!<Esc>')
|
||||
|
||||
set_session(client_super)
|
||||
local screen = thelpers.screen_setup(0,
|
||||
local screen_client = thelpers.screen_setup(0,
|
||||
string.format([=[["%s", "--server", "%s", "--remote-ui"]]=],
|
||||
nvim_prog, server_pipe))
|
||||
|
||||
screen:expect{grid=[[
|
||||
screen_client:expect{grid=[[
|
||||
Halloj{1:!} |
|
||||
{4:~ }|
|
||||
{4:~ }|
|
||||
@@ -2751,7 +2745,7 @@ describe("TUI as a client", function()
|
||||
-- No heap-use-after-free when receiving UI events after deadly signal #22184
|
||||
server:request('nvim_input', ('a'):rep(1000))
|
||||
exec_lua([[vim.uv.kill(vim.fn.jobpid(vim.bo.channel), 'sigterm')]])
|
||||
screen:expect{grid=[[
|
||||
screen_client:expect{grid=[[
|
||||
Vim: Caught deadly signal 'SIGTERM' |
|
||||
|
|
||||
|
|
||||
@@ -2866,7 +2860,6 @@ describe("TUI as a client", function()
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
|
||||
|
||||
server_super:close()
|
||||
client_super:close()
|
||||
end
|
||||
|
Reference in New Issue
Block a user