test: fix VimResume test flakiness (#24438)

This commit is contained in:
zeertzjq 2023-07-23 10:03:05 +08:00 committed by GitHub
parent f0d618667a
commit f56c184809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,46 +92,32 @@ it('autocmds VimSuspend/VimResume #22041', function()
eq(false, screen.suspended)
feed('<C-Z>')
screen:expect(function() eq (true, screen.suspended) end)
screen:expect(function() eq(true, screen.suspended) end)
eq({ 's' }, eval('g:ev'))
screen.suspended = false
feed('<Ignore>')
eq({ 's', 'r' }, eval('g:ev'))
command('suspend')
screen:expect(function() eq (true, screen.suspended) end)
screen:expect(function() eq(true, screen.suspended) end)
eq({ 's', 'r', 's' }, eval('g:ev'))
screen.suspended = false
meths.input_mouse('move', '', '', 0, 0, 0)
eq({ 's', 'r', 's', 'r' }, eval('g:ev'))
feed('<C-Z>')
screen:expect(function() eq (true, screen.suspended) end)
feed('<C-Z><C-Z><C-Z>')
screen:expect(function() eq(true, screen.suspended) end)
meths.ui_set_focus(false)
eq({ 's', 'r', 's', 'r', 's' }, eval('g:ev'))
screen.suspended = false
meths.ui_set_focus(true)
eq({ 's', 'r', 's', 'r', 's', 'r' }, eval('g:ev'))
command('suspend')
screen:expect(function() eq (true, screen.suspended) end)
command('suspend | suspend | suspend')
screen:expect(function() eq(true, screen.suspended) end)
screen:detach()
eq({ 's', 'r', 's', 'r', 's', 'r', 's' }, eval('g:ev'))
screen.suspended = false
screen:attach()
eq({ 's', 'r', 's', 'r', 's', 'r', 's', 'r' }, eval('g:ev'))
eq(false, screen.suspended)
feed('<C-Z><C-Z><C-Z><C-Z>')
screen:expect(function() eq (true, screen.suspended) end)
eq({ 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's' }, eval('g:ev'))
screen.suspended = false
feed('<C-Z><C-Z><C-Z><C-Z>')
eq({ 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's' }, eval('g:ev'))
screen:expect(function() eq (true, screen.suspended) end)
screen.suspended = false
feed('i<C-R>=g:ev<CR>')
eq({ 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's', 'r' }, eval('g:ev'))
eq({ 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's', 'r', 's', 'r', '' },
meths.buf_get_lines(0, 0, -1, true))
end)