diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-09-04 22:45:14 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-09-04 22:51:04 +0200 |
commit | ce852bab04c63262ce8545c01a4ff4fc827148a1 (patch) | |
tree | b344eaa2a93c2d63049e9b95bac0ab4b82525a5e /test/functional/api/vim_spec.lua | |
parent | f050aaabbb31b58ebac519a6f7014610f2b119f0 (diff) | |
download | rneovim-ce852bab04c63262ce8545c01a4ff4fc827148a1.tar.gz rneovim-ce852bab04c63262ce8545c01a4ff4fc827148a1.tar.bz2 rneovim-ce852bab04c63262ce8545c01a4ff4fc827148a1.zip |
eventloop: K_EVENT does not finish mapping
The "mapping" tests added in 541dde36e330 were flawed:
- Unlike op-pending mode, RPCs are _blocked_ during map-pending. So
a synchronous RPC like nvim_get_current_buf() waits until
'timeoutlen', then the mapping is canceled.
- helpers.expect() also performs a blocking RPC, so again that must not
intervene the two nvim_input() calls.
closes #6166
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 252a380378..a4b643589a 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -346,37 +346,33 @@ describe('api', function() end) describe('RPC (K_EVENT) #6166', function() - it('does not complete/interrupt normal-mode operator', function() + it('does not complete ("interrupt") normal-mode operator-pending', function() helpers.insert([[ FIRST LINE SECOND LINE]]) nvim('input', 'gg') nvim('input', 'gu') - -- Make any non-async RPC request. + -- Make any RPC request (can be non-async: op-pending does not block). nvim('get_current_buf') -- Buffer should not change. helpers.expect([[ FIRST LINE SECOND LINE]]) -- Now send input to complete the operator. - nvim("input", "j") + nvim('input', 'j') helpers.expect([[ - first line - second line]]) + first line + second line]]) end) - -- TODO: bug #6166 - pending('does not complete/interrupt normal-mode mapping', function() + it('does not complete ("interrupt") normal-mode map-pending', function() command("nnoremap dd :let g:foo='it worked...'<CR>") helpers.insert([[ FIRST LINE SECOND LINE]]) nvim('input', 'gg') nvim('input', 'd') - helpers.expect([[ - FIRST LINE - SECOND LINE]]) - -- Make any non-async RPC request. (expect() does RPC, but be explicit) - nvim('get_current_buf') + -- Make any RPC request (must be async, because map-pending blocks). + nvim('get_api_info') -- Send input to complete the mapping. nvim('input', 'd') helpers.expect([[ @@ -384,22 +380,20 @@ describe('api', function() SECOND LINE]]) eq('it worked...', helpers.eval('g:foo')) end) - it('does not complete/interrupt insert-mode mapping', function() - command("inoremap xx foo") + it('does not complete ("interrupt") insert-mode map-pending', function() + command('inoremap xx foo') + command('set timeoutlen=9999') helpers.insert([[ FIRST LINE SECOND LINE]]) nvim('input', 'ix') - helpers.expect([[ - FIRST LINE - SECOND LINxE]]) - -- Make any non-async RPC request. (expect() does RPC, but be explicit) - nvim('get_current_buf') + -- Make any RPC request (must be async, because map-pending blocks). + nvim('get_api_info') -- Send input to complete the mapping. nvim('input', 'x') helpers.expect([[ FIRST LINE - SECOND LINxxE]]) -- TODO: should be "SECOND LINfooE" #6166 + SECOND LINfooE]]) end) end) |