test: make some tests more stable (#16860)

This commit is contained in:
zeertzjq 2022-01-01 22:28:52 +08:00 committed by GitHub
parent 5dbc64dced
commit a5eadbaf3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 26 deletions

View File

@ -350,7 +350,7 @@ describe('on_lines does not emit out-of-bounds line indexes when', function()
end)
it('creating a terminal buffer #16394', function()
feed_command([[autocmd TermOpen * ++once call v:lua.register_callback(expand("<abuf>"))]])
feed_command('autocmd TermOpen * ++once call v:lua.register_callback(str2nr(expand("<abuf>")))')
feed_command('terminal')
sleep(500)
eq('', exec_lua([[return _G.cb_error]]))

View File

@ -20,7 +20,6 @@ local nvim_prog = helpers.nvim_prog
local nvim_set = helpers.nvim_set
local ok = helpers.ok
local read_file = helpers.read_file
local exec_lua = helpers.exec_lua
if helpers.pending_win32(pending) then return end
@ -581,34 +580,21 @@ describe('TUI', function()
end)
it("paste: 'nomodifiable' buffer", function()
local has_luajit = exec_lua('return jit ~= nil')
child_session:request('nvim_command', 'set nomodifiable')
child_session:request('nvim_exec_lua', [[
-- Stack traces for this test are non-deterministic, so disable them
_G.debug.traceback = function(msg) return msg end
-- Truncate the error message to hide the line number
_G.debug.traceback = function(msg) return msg:sub(-49) end
]], {})
feed_data('\027[200~fail 1\nfail 2\n\027[201~')
if has_luajit then
screen:expect{grid=[[
|
{4:~ }|
{5: }|
{8:paste: Error executing lua: vim.lua:0: Vim:E21: Ca}|
{8:nnot make changes, 'modifiable' is off} |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]]}
else
screen:expect{grid=[[
|
{4:~ }|
{5: }|
{8:paste: Error executing lua: Vim:E21: Cannot make c}|
{8:hanges, 'modifiable' is off} |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]]}
end
screen:expect{grid=[[
|
{4:~ }|
{5: }|
{8:paste: Error executing lua: Vim:E21: Cannot make c}|
{8:hanges, 'modifiable' is off} |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]]}
feed_data('\n') -- <Enter>
child_session:request('nvim_command', 'set modifiable')
feed_data('\027[200~success 1\nsuccess 2\n\027[201~')