mirror of
https://github.com/neovim/neovim.git
synced 2025-12-20 13:25:34 +00:00
test: set notermguicolors in tests
Set 'notermguicolors' in tests which spawn a child Nvim process to force existing tests to use 16 colors. Also refactor the child process invocation to make things a little bit less messy.
This commit is contained in:
@@ -2,7 +2,6 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local thelpers = require('test.functional.terminal.helpers')
|
local thelpers = require('test.functional.terminal.helpers')
|
||||||
local luv = require('luv')
|
local luv = require('luv')
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local nvim_prog = helpers.nvim_prog
|
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
local feed_data = thelpers.feed_data
|
local feed_data = thelpers.feed_data
|
||||||
|
|
||||||
@@ -14,10 +13,12 @@ describe('autoread TUI FocusGained/FocusLost', function()
|
|||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = thelpers.screen_setup(
|
screen = thelpers.setup_child_nvim({
|
||||||
0,
|
'-u', 'NONE',
|
||||||
'["'..nvim_prog..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "set noswapfile noshowcmd noruler"]'
|
'-i', 'NONE',
|
||||||
)
|
'--cmd', 'colorscheme vim',
|
||||||
|
'--cmd', 'set noswapfile noshowcmd noruler notermguicolors',
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
teardown(function()
|
teardown(function()
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ describe('command-line option', function()
|
|||||||
screen:attach()
|
screen:attach()
|
||||||
local args = {
|
local args = {
|
||||||
nvim_prog_abs(), '-u', 'NONE', '-i', 'NONE',
|
nvim_prog_abs(), '-u', 'NONE', '-i', 'NONE',
|
||||||
'--cmd', '"set noswapfile shortmess+=IFW fileformats=unix"',
|
'--cmd', '"set noswapfile shortmess+=IFW fileformats=unix notermguicolors"',
|
||||||
'-s', '-'
|
'-s', '-'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ module.nvim_prog = (
|
|||||||
module.nvim_set = (
|
module.nvim_set = (
|
||||||
'set shortmess+=IS background=light noswapfile noautoindent startofline'
|
'set shortmess+=IS background=light noswapfile noautoindent startofline'
|
||||||
..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
|
..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
|
||||||
..' belloff= wildoptions-=pum joinspaces noshowcmd noruler nomore redrawdebug=invalid')
|
..' belloff= wildoptions-=pum joinspaces noshowcmd noruler nomore redrawdebug=invalid'
|
||||||
|
..' notermguicolors')
|
||||||
module.nvim_argv = {
|
module.nvim_argv = {
|
||||||
module.nvim_prog, '-u', 'NONE', '-i', 'NONE',
|
module.nvim_prog, '-u', 'NONE', '-i', 'NONE',
|
||||||
-- XXX: find treesitter parsers.
|
-- XXX: find treesitter parsers.
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ describe('api', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
helpers.clear()
|
helpers.clear()
|
||||||
os.remove(socket_name)
|
os.remove(socket_name)
|
||||||
screen = child_session.screen_setup(0, '["'..helpers.nvim_prog
|
screen = child_session.setup_child_nvim({
|
||||||
..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "'..helpers.nvim_set..'"]')
|
'-u', 'NONE',
|
||||||
|
'-i', 'NONE',
|
||||||
|
'--cmd', 'colorscheme vim',
|
||||||
|
'--cmd', helpers.nvim_set,
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
os.remove(socket_name)
|
os.remove(socket_name)
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ local sleep = helpers.sleep
|
|||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
local skip = helpers.skip
|
local skip = helpers.skip
|
||||||
local nvim_prog = helpers.nvim_prog
|
|
||||||
|
|
||||||
describe(':terminal buffer', function()
|
describe(':terminal buffer', function()
|
||||||
local screen
|
local screen
|
||||||
@@ -446,10 +445,13 @@ end)
|
|||||||
describe('terminal input', function()
|
describe('terminal input', function()
|
||||||
it('sends various special keys with modifiers', function()
|
it('sends various special keys with modifiers', function()
|
||||||
clear()
|
clear()
|
||||||
local screen = thelpers.screen_setup(
|
local screen = thelpers.setup_child_nvim({
|
||||||
0,
|
'-u', 'NONE',
|
||||||
string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", 'colorscheme vim', "--cmd", "startinsert"]]=], nvim_prog)
|
'-i', 'NONE',
|
||||||
)
|
'--cmd', 'colorscheme vim',
|
||||||
|
'--cmd', 'set notermguicolors',
|
||||||
|
'--cmd', 'startinsert',
|
||||||
|
})
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ local Screen = require('test.functional.ui.screen')
|
|||||||
local thelpers = require('test.functional.terminal.helpers')
|
local thelpers = require('test.functional.terminal.helpers')
|
||||||
local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
|
local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
|
||||||
local testprg, command = helpers.testprg, helpers.command
|
local testprg, command = helpers.testprg, helpers.command
|
||||||
local nvim_prog = helpers.nvim_prog
|
|
||||||
local eq, eval = helpers.eq, helpers.eval
|
local eq, eval = helpers.eq, helpers.eval
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local poke_eventloop = helpers.poke_eventloop
|
local poke_eventloop = helpers.poke_eventloop
|
||||||
@@ -184,10 +183,18 @@ describe('buffer cursor position is correct in terminal without number column',
|
|||||||
local screen
|
local screen
|
||||||
|
|
||||||
local function setup_ex_register(str)
|
local function setup_ex_register(str)
|
||||||
screen = thelpers.screen_setup(0, '["'..nvim_prog
|
screen = thelpers.setup_child_nvim({
|
||||||
..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]]
|
'-u', 'NONE',
|
||||||
|
'-i', 'NONE',
|
||||||
|
'-E',
|
||||||
|
'--cmd', string.format('let @r = "%s"', str),
|
||||||
-- <Left> and <Right> don't always work
|
-- <Left> and <Right> don't always work
|
||||||
..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70)
|
'--cmd', 'cnoremap <C-X> <Left>',
|
||||||
|
'--cmd', 'cnoremap <C-O> <Right>',
|
||||||
|
'--cmd', 'set notermguicolors',
|
||||||
|
}, {
|
||||||
|
cols = 70,
|
||||||
|
})
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
[1] = {foreground = 253, background = 11};
|
[1] = {foreground = 253, background = 11};
|
||||||
[3] = {bold = true},
|
[3] = {bold = true},
|
||||||
@@ -570,10 +577,18 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
|||||||
local screen
|
local screen
|
||||||
|
|
||||||
local function setup_ex_register(str)
|
local function setup_ex_register(str)
|
||||||
screen = thelpers.screen_setup(0, '["'..nvim_prog
|
screen = thelpers.setup_child_nvim({
|
||||||
..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]]
|
'-u', 'NONE',
|
||||||
|
'-i', 'NONE',
|
||||||
|
'-E',
|
||||||
|
'--cmd', string.format('let @r = "%s"', str),
|
||||||
-- <Left> and <Right> don't always work
|
-- <Left> and <Right> don't always work
|
||||||
..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70)
|
'--cmd', 'cnoremap <C-X> <Left>',
|
||||||
|
'--cmd', 'cnoremap <C-O> <Right>',
|
||||||
|
'--cmd', 'set notermguicolors',
|
||||||
|
}, {
|
||||||
|
cols = 70,
|
||||||
|
})
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
[1] = {foreground = 253, background = 11};
|
[1] = {foreground = 253, background = 11};
|
||||||
[3] = {bold = true},
|
[3] = {bold = true},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ local Screen = require('test.functional.ui.screen')
|
|||||||
local testprg = helpers.testprg
|
local testprg = helpers.testprg
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local nvim = helpers.nvim
|
local nvim = helpers.nvim
|
||||||
|
local nvim_prog = helpers.nvim_prog
|
||||||
|
|
||||||
local function feed_data(data)
|
local function feed_data(data)
|
||||||
if type(data) == 'table' then
|
if type(data) == 'table' then
|
||||||
@@ -122,6 +123,26 @@ local function screen_setup(extra_rows, command, cols, opts)
|
|||||||
return screen
|
return screen
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function setup_child_nvim(args, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
local argv = { nvim_prog, unpack(args) }
|
||||||
|
local cmd = string.format('[%s]', vim.iter(argv):map(function(s)
|
||||||
|
return string.format('\'%s\'', s)
|
||||||
|
end):join(', '))
|
||||||
|
|
||||||
|
if opts.env then
|
||||||
|
local s = {}
|
||||||
|
for k, v in pairs(opts.env) do
|
||||||
|
table.insert(s, string.format('%s: \'%s\'', k, v))
|
||||||
|
end
|
||||||
|
|
||||||
|
cmd = string.format('%s, #{env: #{%s}}', cmd, table.concat(s, ', '))
|
||||||
|
end
|
||||||
|
|
||||||
|
return screen_setup(0, cmd, opts.cols)
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
feed_data = feed_data,
|
feed_data = feed_data,
|
||||||
feed_termcode = feed_termcode,
|
feed_termcode = feed_termcode,
|
||||||
@@ -141,5 +162,6 @@ return {
|
|||||||
clear_attrs = clear_attrs,
|
clear_attrs = clear_attrs,
|
||||||
enable_mouse = enable_mouse,
|
enable_mouse = enable_mouse,
|
||||||
disable_mouse = disable_mouse,
|
disable_mouse = disable_mouse,
|
||||||
screen_setup = screen_setup
|
screen_setup = screen_setup,
|
||||||
|
setup_child_nvim = setup_child_nvim,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ describe('TUI', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
local child_server = new_pipename()
|
local child_server = new_pipename()
|
||||||
screen = thelpers.screen_setup(0,
|
screen = thelpers.setup_child_nvim({
|
||||||
string.format(
|
'--listen', child_server,
|
||||||
[=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark", "--cmd", "colorscheme vim"]]=],
|
'-u', 'NONE',
|
||||||
nvim_prog,
|
'-i', 'NONE',
|
||||||
child_server,
|
'--cmd', string.format('%s laststatus=2 background=dark', nvim_set),
|
||||||
nvim_set
|
'--cmd', 'colorscheme vim'
|
||||||
))
|
})
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
@@ -1830,7 +1830,7 @@ describe('TUI', function()
|
|||||||
})
|
})
|
||||||
screen:attach()
|
screen:attach()
|
||||||
exec([[
|
exec([[
|
||||||
call termopen([v:progpath, '--clean', '--cmd', 'colorscheme vim', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile'])
|
call termopen([v:progpath, '--clean', '--cmd', 'set notermguicolors', '--cmd', 'colorscheme vim', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile'])
|
||||||
sleep 500m
|
sleep 500m
|
||||||
vs new
|
vs new
|
||||||
]])
|
]])
|
||||||
@@ -1856,30 +1856,29 @@ describe('TUI', function()
|
|||||||
write_file(script_file, [=[
|
write_file(script_file, [=[
|
||||||
local ffi = require('ffi')
|
local ffi = require('ffi')
|
||||||
ffi.cdef([[int execl(const char *, const char *, ...);]])
|
ffi.cdef([[int execl(const char *, const char *, ...);]])
|
||||||
ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean', '--cmd', 'colorscheme vim')
|
ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean')
|
||||||
]=])
|
]=])
|
||||||
finally(function()
|
finally(function()
|
||||||
os.remove(script_file)
|
os.remove(script_file)
|
||||||
end)
|
end)
|
||||||
local screen = thelpers.screen_setup(0, string.format([=[["%s", "--clean", "-l", "%s"]]=],
|
local screen = thelpers.setup_child_nvim({'--clean', '-l', script_file})
|
||||||
nvim_prog, script_file))
|
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
~ |
|
||||||
{4:~ }|
|
~ |
|
||||||
{4:~ }|
|
~ |
|
||||||
{5:[No Name] 0,0-1 All}|
|
[No Name] 0,0-1 All|
|
||||||
|
|
|
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]]}
|
]]}
|
||||||
feed_data(':put =v:argv + [v:progname]\n')
|
feed_data(':put =v:argv + [v:progname]\n')
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
|
Xargv0nvim |
|
||||||
|
--embed |
|
||||||
--clean |
|
--clean |
|
||||||
--cmd |
|
|
||||||
colorscheme vim |
|
|
||||||
{1:X}argv0nvim |
|
{1:X}argv0nvim |
|
||||||
{5:[No Name] [+] 7,1 Bot}|
|
[No Name] [+] 5,1 Bot|
|
||||||
6 more lines |
|
4 more lines |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
@@ -1903,11 +1902,13 @@ describe('TUI', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('<C-h> #10134', function()
|
it('<C-h> #10134', function()
|
||||||
local screen = thelpers.screen_setup(
|
local screen = thelpers.setup_child_nvim({
|
||||||
0,
|
'-u', 'NONE',
|
||||||
'["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", ]]
|
'-i', 'NONE',
|
||||||
..[["--cmd", "set noruler", "--cmd", ':nnoremap <C-h> :echomsg "\<C-h\>"<CR>']]..']'
|
'--cmd', 'colorscheme vim',
|
||||||
)
|
'--cmd', 'set noruler notermguicolors',
|
||||||
|
'--cmd', ':nnoremap <C-h> :echomsg "\\<C-h\\>"<CR>',
|
||||||
|
})
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
@@ -1931,12 +1932,13 @@ describe('TUI', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('draws line with many trailing spaces correctly #24955', function()
|
it('draws line with many trailing spaces correctly #24955', function()
|
||||||
local screen = thelpers.screen_setup(
|
local screen = thelpers.setup_child_nvim({
|
||||||
0,
|
'-u', 'NONE',
|
||||||
'["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim"]]
|
'-i', 'NONE',
|
||||||
..[[, "--cmd", "call setline(1, ['1st line' .. repeat(' ', 153), '2nd line'])"]]..']',
|
'--cmd', 'set notermguicolors',
|
||||||
80
|
'--cmd', 'colorscheme vim',
|
||||||
)
|
'--cmd', 'call setline(1, ["1st line" .. repeat(" ", 153), "2nd line"])',
|
||||||
|
}, { cols = 80 })
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
{1:1}st line |
|
{1:1}st line |
|
||||||
|
|
|
|
||||||
@@ -1962,16 +1964,16 @@ end)
|
|||||||
describe('TUI UIEnter/UILeave', function()
|
describe('TUI UIEnter/UILeave', function()
|
||||||
it('fires exactly once, after VimEnter', function()
|
it('fires exactly once, after VimEnter', function()
|
||||||
clear()
|
clear()
|
||||||
local screen = thelpers.screen_setup(0,
|
local screen = thelpers.setup_child_nvim({
|
||||||
'["'..nvim_prog..'", "-u", "NONE", "-i", "NONE"'
|
'-u', 'NONE',
|
||||||
..[[, "--cmd", "colorscheme vim"]]
|
'-i', 'NONE',
|
||||||
..[[, "--cmd", "set noswapfile noshowcmd noruler"]]
|
'--cmd', 'colorscheme vim',
|
||||||
..[[, "--cmd", "let g:evs = []"]]
|
'--cmd', 'set noswapfile noshowcmd noruler notermguicolors',
|
||||||
..[[, "--cmd", "autocmd UIEnter * :call add(g:evs, 'UIEnter')"]]
|
'--cmd', 'let g:evs = []',
|
||||||
..[[, "--cmd", "autocmd UILeave * :call add(g:evs, 'UILeave')"]]
|
'--cmd', 'autocmd UIEnter * :call add(g:evs, "UIEnter")',
|
||||||
..[[, "--cmd", "autocmd VimEnter * :call add(g:evs, 'VimEnter')"]]
|
'--cmd', 'autocmd UILeave * :call add(g:evs, "UILeave")',
|
||||||
..']'
|
'--cmd', 'autocmd VimEnter * :call add(g:evs, "VimEnter")',
|
||||||
)
|
})
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
@@ -2001,11 +2003,14 @@ describe('TUI FocusGained/FocusLost', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
local child_server = new_pipename()
|
local child_server = new_pipename()
|
||||||
screen = thelpers.screen_setup(0,
|
screen = thelpers.setup_child_nvim({
|
||||||
string.format(
|
'--listen', child_server,
|
||||||
'["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", '
|
'-u', 'NONE',
|
||||||
..'"--cmd", "set noswapfile noshowcmd noruler"]',
|
'-i', 'NONE',
|
||||||
nvim_prog, child_server))
|
'--cmd', 'colorscheme vim',
|
||||||
|
'--cmd', 'set noswapfile noshowcmd noruler notermguicolors',
|
||||||
|
})
|
||||||
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
@@ -2208,14 +2213,18 @@ describe("TUI 't_Co' (terminal colors)", function()
|
|||||||
|
|
||||||
local function assert_term_colors(term, colorterm, maxcolors)
|
local function assert_term_colors(term, colorterm, maxcolors)
|
||||||
clear({env={TERM=term}, args={}})
|
clear({env={TERM=term}, args={}})
|
||||||
-- This is ugly because :term/termopen() forces TERM=xterm-256color.
|
screen = thelpers.setup_child_nvim({
|
||||||
-- TODO: Revisit this after jobstart/termopen accept `env` dict.
|
'-u', 'NONE',
|
||||||
screen = thelpers.screen_setup(0, string.format(
|
'-i', 'NONE',
|
||||||
[=[['sh', '-c', 'LANG=C TERM=%s %s %s -u NONE -i NONE --cmd "colorscheme vim" --cmd "%s"']]=],
|
'--cmd', 'colorscheme vim',
|
||||||
term or "",
|
'--cmd', nvim_set,
|
||||||
(colorterm ~= nil and "COLORTERM="..colorterm or ""),
|
}, {
|
||||||
nvim_prog,
|
env = {
|
||||||
nvim_set))
|
LANG = 'C',
|
||||||
|
TERM = term or '',
|
||||||
|
COLORTERM = colorterm or '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
local tline
|
local tline
|
||||||
if maxcolors == 8 then
|
if maxcolors == 8 then
|
||||||
@@ -2483,14 +2492,16 @@ describe("TUI 'term' option", function()
|
|||||||
|
|
||||||
local function assert_term(term_envvar, term_expected)
|
local function assert_term(term_envvar, term_expected)
|
||||||
clear()
|
clear()
|
||||||
-- This is ugly because :term/termopen() forces TERM=xterm-256color.
|
screen = thelpers.setup_child_nvim({
|
||||||
-- TODO: Revisit this after jobstart/termopen accept `env` dict.
|
'-u', 'NONE',
|
||||||
local cmd = string.format(
|
'-i', 'NONE',
|
||||||
[=[['sh', '-c', 'LANG=C TERM=%s %s -u NONE -i NONE --cmd "%s"']]=],
|
'--cmd', nvim_set,
|
||||||
term_envvar or "",
|
}, {
|
||||||
nvim_prog,
|
env = {
|
||||||
nvim_set)
|
LANG = 'C',
|
||||||
screen = thelpers.screen_setup(0, cmd)
|
TERM = term_envvar or '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
local full_timeout = screen.timeout
|
local full_timeout = screen.timeout
|
||||||
screen.timeout = 250 -- We want screen:expect() to fail quickly.
|
screen.timeout = 250 -- We want screen:expect() to fail quickly.
|
||||||
@@ -2540,14 +2551,17 @@ describe("TUI", function()
|
|||||||
-- Runs (child) `nvim` in a TTY (:terminal), to start the builtin TUI.
|
-- Runs (child) `nvim` in a TTY (:terminal), to start the builtin TUI.
|
||||||
local function nvim_tui(extra_args)
|
local function nvim_tui(extra_args)
|
||||||
clear()
|
clear()
|
||||||
-- This is ugly because :term/termopen() forces TERM=xterm-256color.
|
screen = thelpers.setup_child_nvim({
|
||||||
-- TODO: Revisit this after jobstart/termopen accept `env` dict.
|
'-u', 'NONE',
|
||||||
local cmd = string.format(
|
'-i', 'NONE',
|
||||||
[=[['sh', '-c', 'LANG=C %s -u NONE -i NONE %s --cmd "colorscheme vim" --cmd "%s"']]=],
|
'--cmd', 'colorscheme vim',
|
||||||
nvim_prog,
|
'--cmd', nvim_set,
|
||||||
extra_args or "",
|
extra_args,
|
||||||
nvim_set)
|
}, {
|
||||||
screen = thelpers.screen_setup(0, cmd)
|
env = {
|
||||||
|
LANG = 'C',
|
||||||
|
},
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it('-V3log logs terminfo values', function()
|
it('-V3log logs terminfo values', function()
|
||||||
@@ -2604,9 +2618,18 @@ describe('TUI bg color', function()
|
|||||||
|
|
||||||
local function setup_bg_test()
|
local function setup_bg_test()
|
||||||
clear()
|
clear()
|
||||||
screen = thelpers.screen_setup(0, '["'..nvim_prog
|
screen = thelpers.setup_child_nvim({
|
||||||
..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "set noswapfile", '
|
'-u',
|
||||||
..'"-c", "autocmd OptionSet background echo \\"did OptionSet, yay!\\""]')
|
'NONE',
|
||||||
|
'-i',
|
||||||
|
'NONE',
|
||||||
|
'--cmd',
|
||||||
|
'colorscheme vim',
|
||||||
|
'--cmd',
|
||||||
|
'set noswapfile notermguicolors',
|
||||||
|
'-c',
|
||||||
|
'autocmd OptionSet background echo "did OptionSet, yay!"',
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
before_each(setup_bg_test)
|
before_each(setup_bg_test)
|
||||||
@@ -2725,14 +2748,13 @@ describe("TUI as a client", function()
|
|||||||
|
|
||||||
set_session(server_super)
|
set_session(server_super)
|
||||||
local server_pipe = new_pipename()
|
local server_pipe = new_pipename()
|
||||||
local screen_server = thelpers.screen_setup(0,
|
local screen_server = thelpers.setup_child_nvim({
|
||||||
string.format(
|
'--listen', server_pipe,
|
||||||
'["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", '
|
'-u', 'NONE',
|
||||||
..'"--cmd", "%s laststatus=2 background=dark"]',
|
'-i', 'NONE',
|
||||||
nvim_prog,
|
'--cmd', 'colorscheme vim',
|
||||||
server_pipe,
|
'--cmd', string.format('%s laststatus=2 background=dark', nvim_set),
|
||||||
nvim_set
|
})
|
||||||
))
|
|
||||||
|
|
||||||
feed_data("iHello, World")
|
feed_data("iHello, World")
|
||||||
screen_server:expect{grid=[[
|
screen_server:expect{grid=[[
|
||||||
@@ -2756,9 +2778,10 @@ describe("TUI as a client", function()
|
|||||||
]]}
|
]]}
|
||||||
|
|
||||||
set_session(client_super)
|
set_session(client_super)
|
||||||
local screen_client = thelpers.screen_setup(0,
|
local screen_client = thelpers.setup_child_nvim({
|
||||||
string.format([=[["%s", "--server", "%s", "--remote-ui"]]=],
|
'--server', server_pipe,
|
||||||
nvim_prog, server_pipe))
|
'--remote-ui',
|
||||||
|
})
|
||||||
|
|
||||||
screen_client:expect{grid=[[
|
screen_client:expect{grid=[[
|
||||||
Hello, Worl{1:d} |
|
Hello, Worl{1:d} |
|
||||||
@@ -2798,9 +2821,10 @@ describe("TUI as a client", function()
|
|||||||
server:request('nvim_input', 'iHalloj!<Esc>')
|
server:request('nvim_input', 'iHalloj!<Esc>')
|
||||||
|
|
||||||
set_session(client_super)
|
set_session(client_super)
|
||||||
local screen_client = thelpers.screen_setup(0,
|
local screen_client = thelpers.setup_child_nvim({
|
||||||
string.format([=[["%s", "--server", "%s", "--remote-ui"]]=],
|
'--server', server_pipe,
|
||||||
nvim_prog, server_pipe))
|
'--remote-ui',
|
||||||
|
})
|
||||||
|
|
||||||
screen_client:expect{grid=[[
|
screen_client:expect{grid=[[
|
||||||
Halloj{1:!} |
|
Halloj{1:!} |
|
||||||
@@ -2836,9 +2860,10 @@ describe("TUI as a client", function()
|
|||||||
|
|
||||||
it("throws error when no server exists", function()
|
it("throws error when no server exists", function()
|
||||||
clear()
|
clear()
|
||||||
local screen = thelpers.screen_setup(0,
|
local screen = thelpers.setup_child_nvim({
|
||||||
string.format([=[["%s", "--server", "127.0.0.1:2436546", "--remote-ui"]]=],
|
'--server', '127.0.0.1:2436546',
|
||||||
nvim_prog), 60)
|
'--remote-ui',
|
||||||
|
}, { cols = 60 })
|
||||||
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
Remote ui failed to start: {MATCH:.*}|
|
Remote ui failed to start: {MATCH:.*}|
|
||||||
@@ -2857,14 +2882,13 @@ describe("TUI as a client", function()
|
|||||||
|
|
||||||
set_session(server_super)
|
set_session(server_super)
|
||||||
local server_pipe = new_pipename()
|
local server_pipe = new_pipename()
|
||||||
local screen_server = thelpers.screen_setup(0,
|
local screen_server = thelpers.setup_child_nvim({
|
||||||
string.format(
|
'--listen', server_pipe,
|
||||||
'["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", '
|
'-u', 'NONE',
|
||||||
..'"--cmd", "%s laststatus=2 background=dark"]',
|
'-i', 'NONE',
|
||||||
nvim_prog,
|
'--cmd', 'colorscheme vim',
|
||||||
server_pipe,
|
'--cmd', string.format('%s laststatus=2 background=dark', nvim_set),
|
||||||
nvim_set
|
})
|
||||||
))
|
|
||||||
screen_server:expect{grid=[[
|
screen_server:expect{grid=[[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
@@ -2897,9 +2921,10 @@ describe("TUI as a client", function()
|
|||||||
]]}
|
]]}
|
||||||
|
|
||||||
set_session(client_super)
|
set_session(client_super)
|
||||||
local screen_client = thelpers.screen_setup(0,
|
local screen_client = thelpers.setup_child_nvim({
|
||||||
string.format([=[["%s", "--server", "%s", "--remote-ui"]]=],
|
'--server', server_pipe,
|
||||||
nvim_prog, server_pipe))
|
'--remote-ui',
|
||||||
|
})
|
||||||
|
|
||||||
screen_client:expect{grid=[[
|
screen_client:expect{grid=[[
|
||||||
Hello, Worl{1:d} |
|
Hello, Worl{1:d} |
|
||||||
|
|||||||
@@ -21,8 +21,12 @@ describe("shell command :!", function()
|
|||||||
local screen
|
local screen
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = child_session.screen_setup(0, '["'..helpers.nvim_prog..
|
screen = child_session.setup_child_nvim({
|
||||||
'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "'..helpers.nvim_set..'"]')
|
'-u', 'NONE',
|
||||||
|
'-i', 'NONE',
|
||||||
|
'--cmd', 'colorscheme vim',
|
||||||
|
'--cmd', helpers.nvim_set,
|
||||||
|
})
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
|
|||||||
Reference in New Issue
Block a user