vim-patch:9.0.1779: Need more state() tests (#24840)

Problem:  Need more state() tests
Solution: Add a few more tests for operater pending mode and register
          yank command

closes: vim/vim#12883

8dabccd295
This commit is contained in:
zeertzjq
2023-08-23 06:42:10 +08:00
committed by GitHub
parent 20f76ebf2b
commit 6462ee1c10
2 changed files with 29 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ local poke_eventloop = helpers.poke_eventloop
before_each(clear)
describe('state() function', function()
-- oldtest: Test_state()
it('works', function()
meths.ui_attach(80, 24, {}) -- Allow hit-enter-prompt
@@ -51,6 +52,20 @@ describe('state() function', function()
feed(';')
eq({ 'mS', 'n' }, exec_lua('return _G.res'))
-- An operator is pending
feed([[:call RunTimer()<CR>y]])
poke_eventloop() -- Process pending input
poke_eventloop() -- Process time_event
feed('y')
eq({ 'oSc', 'n' }, exec_lua('return _G.res'))
-- A register was specified
feed([[:call RunTimer()<CR>"r]])
poke_eventloop() -- Process pending input
poke_eventloop() -- Process time_event
feed('yy')
eq({ 'oSc', 'n' }, exec_lua('return _G.res'))
-- Insert mode completion
feed([[:call RunTimer()<CR>Got<C-N>]])
poke_eventloop() -- Process pending input