test: reduce flakiness (#24443)

Avoid consecutive RPC requests involving :startinsert or :stopinsert,
because consecutive RPC requests may be processed together, before the
:startinsert or :stopinsert takes effect.

Also change some feed_command() to command() to make tests faster.
This commit is contained in:
zeertzjq
2023-07-23 12:46:56 +08:00
committed by GitHub
parent f56c184809
commit ce56ad2ba7
6 changed files with 45 additions and 45 deletions

View File

@@ -24,8 +24,7 @@ describe(':terminal buffer', function()
before_each(function()
clear()
feed_command('set modifiable swapfile undolevels=20')
poke_eventloop()
command('set modifiable swapfile undolevels=20')
screen = thelpers.screen_setup()
end)
@@ -199,7 +198,6 @@ describe(':terminal buffer', function()
it('handles loss of focus gracefully', function()
-- Change the statusline to avoid printing the file name, which varies.
nvim('set_option_value', 'statusline', '==========', {})
feed_command('set laststatus=0')
-- Save the buffer number of the terminal for later testing.
local tbuf = eval('bufnr("%")')
@@ -232,8 +230,6 @@ describe(':terminal buffer', function()
neq(tbuf, eval('bufnr("%")'))
feed_command('quit!') -- Should exit the new window, not the terminal.
eq(tbuf, eval('bufnr("%")'))
feed_command('set laststatus=1') -- Restore laststatus to the default.
end)
it('term_close() use-after-free #4393', function()
@@ -433,7 +429,7 @@ describe('terminal input', function()
_G.input_data = _G.input_data .. data
end })
]])
command('startinsert')
feed('i')
poke_eventloop()
end)