A Mudholland Dr. Recast

The commit summary maybe does not make sense, but calling a function
that does not wait on anything `wait()` makes even less sense.
This commit is contained in:
Björn Linse 2020-10-19 20:17:51 +02:00
parent 288f7f8558
commit 07cc231142
40 changed files with 206 additions and 206 deletions

View File

@ -1252,7 +1252,7 @@ describe('API', function()
{0:~ }| {0:~ }|
{1:very fail} | {1:very fail} |
]]) ]])
helpers.wait() helpers.poke_eventloop()
-- shows up to &cmdheight lines -- shows up to &cmdheight lines
nvim_async('err_write', 'more fail\ntoo fail\n') nvim_async('err_write', 'more fail\ntoo fail\n')

View File

@ -3,7 +3,7 @@ local clear, nvim, curbuf, curbuf_contents, window, curwin, eq, neq,
ok, feed, insert, eval = helpers.clear, helpers.nvim, helpers.curbuf, ok, feed, insert, eval = helpers.clear, helpers.nvim, helpers.curbuf,
helpers.curbuf_contents, helpers.window, helpers.curwin, helpers.eq, helpers.curbuf_contents, helpers.window, helpers.curwin, helpers.eq,
helpers.neq, helpers.ok, helpers.feed, helpers.insert, helpers.eval helpers.neq, helpers.ok, helpers.feed, helpers.insert, helpers.eval
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local curwinmeths = helpers.curwinmeths local curwinmeths = helpers.curwinmeths
local funcs = helpers.funcs local funcs = helpers.funcs
local request = helpers.request local request = helpers.request
@ -82,7 +82,7 @@ describe('API/win', function()
insert("epilogue") insert("epilogue")
local win = curwin() local win = curwin()
feed('gg') feed('gg')
wait() -- let nvim process the 'gg' command poke_eventloop() -- let nvim process the 'gg' command
-- cursor position is at beginning -- cursor position is at beginning
eq({1, 0}, window('get_cursor', win)) eq({1, 0}, window('get_cursor', win))
@ -128,7 +128,7 @@ describe('API/win', function()
insert("second line") insert("second line")
feed('gg') feed('gg')
wait() -- let nvim process the 'gg' command poke_eventloop() -- let nvim process the 'gg' command
-- cursor position is at beginning -- cursor position is at beginning
local win = curwin() local win = curwin()
@ -139,7 +139,7 @@ describe('API/win', function()
-- move down a line -- move down a line
feed('j') feed('j')
wait() -- let nvim process the 'j' command poke_eventloop() -- let nvim process the 'j' command
-- cursor is still in column 5 -- cursor is still in column 5
eq({2, 5}, window('get_cursor', win)) eq({2, 5}, window('get_cursor', win))

View File

@ -8,7 +8,7 @@ local run = helpers.run
local funcs = helpers.funcs local funcs = helpers.funcs
local nvim_prog = helpers.nvim_prog local nvim_prog = helpers.nvim_prog
local redir_exec = helpers.redir_exec local redir_exec = helpers.redir_exec
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('v:exiting', function() describe('v:exiting', function()
local cid local cid
@ -52,7 +52,7 @@ describe(':cquit', function()
local function test_cq(cmdline, exit_code, redir_msg) local function test_cq(cmdline, exit_code, redir_msg)
if redir_msg then if redir_msg then
eq('\n' .. redir_msg, redir_exec(cmdline)) eq('\n' .. redir_msg, redir_exec(cmdline))
wait() poke_eventloop()
eq(2, eval("1+1")) -- Still alive? eq(2, eval("1+1")) -- Still alive?
else else
funcs.system({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '--cmd', cmdline}) funcs.system({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '--cmd', cmdline})

View File

@ -11,7 +11,7 @@ local os_kill = helpers.os_kill
local retry = helpers.retry local retry = helpers.retry
local meths = helpers.meths local meths = helpers.meths
local NIL = helpers.NIL local NIL = helpers.NIL
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local iswin = helpers.iswin local iswin = helpers.iswin
local get_pathsep = helpers.get_pathsep local get_pathsep = helpers.get_pathsep
local pathroot = helpers.pathroot local pathroot = helpers.pathroot
@ -428,7 +428,7 @@ describe('jobs', function()
\ } \ }
let job = jobstart(['cat', '-'], g:callbacks) let job = jobstart(['cat', '-'], g:callbacks)
]]) ]])
wait() poke_eventloop()
source([[ source([[
function! g:JobHandler(job_id, data, event) function! g:JobHandler(job_id, data, event)
endfunction endfunction

View File

@ -4,7 +4,7 @@ local command = helpers.command
local meths = helpers.meths local meths = helpers.meths
local clear = helpers.clear local clear = helpers.clear
local sleep = helpers.sleep local sleep = helpers.sleep
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local feed = helpers.feed local feed = helpers.feed
local eq = helpers.eq local eq = helpers.eq
@ -39,7 +39,7 @@ describe('List support code', function()
feed(':let t_rt = reltime()<CR>:let t_bl = copy(bl)<CR>') feed(':let t_rt = reltime()<CR>:let t_bl = copy(bl)<CR>')
sleep(min_dur / 16 * 1000) sleep(min_dur / 16 * 1000)
feed('<C-c>') feed('<C-c>')
wait() poke_eventloop()
command('let t_dur = reltimestr(reltime(t_rt))') command('let t_dur = reltimestr(reltime(t_rt))')
local t_dur = tonumber(meths.get_var('t_dur')) local t_dur = tonumber(meths.get_var('t_dur'))
if t_dur >= dur / 8 then if t_dur >= dur / 8 then
@ -50,7 +50,7 @@ describe('List support code', function()
feed(':let t_rt = reltime()<CR>:let t_j = join(bl)<CR>') feed(':let t_rt = reltime()<CR>:let t_j = join(bl)<CR>')
sleep(min_dur / 16 * 1000) sleep(min_dur / 16 * 1000)
feed('<C-c>') feed('<C-c>')
wait() poke_eventloop()
command('let t_dur = reltimestr(reltime(t_rt))') command('let t_dur = reltimestr(reltime(t_rt))')
local t_dur = tonumber(meths.get_var('t_dur')) local t_dur = tonumber(meths.get_var('t_dur'))
print(('t_dur: %g'):format(t_dur)) print(('t_dur: %g'):format(t_dur))

View File

@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear local clear = helpers.clear
local buf, eq, feed_command = helpers.curbufmeths, helpers.eq, helpers.feed_command local buf, eq, feed_command = helpers.curbufmeths, helpers.eq, helpers.feed_command
local feed, wait = helpers.feed, helpers.wait local feed, poke_eventloop = helpers.feed, helpers.poke_eventloop
local ok = helpers.ok local ok = helpers.ok
local eval = helpers.eval local eval = helpers.eval
@ -90,7 +90,7 @@ describe(':browse oldfiles', function()
feed_command('edit testfile2') feed_command('edit testfile2')
filename2 = buf.get_name() filename2 = buf.get_name()
feed_command('wshada') feed_command('wshada')
wait() poke_eventloop()
_clear() _clear()
-- Ensure nvim is out of "Press ENTER..." prompt. -- Ensure nvim is out of "Press ENTER..." prompt.

View File

@ -554,9 +554,9 @@ function module.curbuf(method, ...)
return module.buffer(method, 0, ...) return module.buffer(method, 0, ...)
end end
function module.wait() function module.poke_eventloop()
-- Execute 'nvim_eval' (a deferred function) to block -- Execute 'nvim_eval' (a deferred function) to
-- until all pending input is processed. -- force at least one main_loop iteration
session:request('nvim_eval', '1') session:request('nvim_eval', '1')
end end
@ -566,7 +566,7 @@ end
--@see buf_lines() --@see buf_lines()
function module.curbuf_contents() function module.curbuf_contents()
module.wait() -- Before inspecting the buffer, process all input. module.poke_eventloop() -- Before inspecting the buffer, do whatever.
return table.concat(module.curbuf('get_lines', 0, -1, true), '\n') return table.concat(module.curbuf('get_lines', 0, -1, true), '\n')
end end

View File

@ -4,7 +4,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('test5', function() describe('test5', function()
setup(clear) setup(clear)
@ -34,7 +34,7 @@ describe('test5', function()
command('bwipe') command('bwipe')
feed('G?this is a<cr>') feed('G?this is a<cr>')
feed('othis is some more text<esc>') feed('othis is some more text<esc>')
wait() poke_eventloop()
-- Append some text to this file. -- Append some text to this file.
@ -45,7 +45,7 @@ describe('test5', function()
command('bwipe!') command('bwipe!')
-- Append an extra line to the output register. -- Append an extra line to the output register.
feed('ithis is another test line<esc>:yank A<cr>') feed('ithis is another test line<esc>:yank A<cr>')
wait() poke_eventloop()
-- Output results -- Output results
command('%d') command('%d')

View File

@ -4,7 +4,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, dedent, eq = helpers.command, helpers.dedent, helpers.eq local command, dedent, eq = helpers.command, helpers.dedent, helpers.eq
local curbuf_contents = helpers.curbuf_contents local curbuf_contents = helpers.curbuf_contents
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('argument list', function() describe('argument list', function()
setup(clear) setup(clear)
@ -17,7 +17,7 @@ describe('argument list', function()
this is a test this is a test
this is a test this is a test
end of test file Xxx]]) end of test file Xxx]])
wait() poke_eventloop()
command('au BufReadPost Xxx2 next Xxx2 Xxx1') command('au BufReadPost Xxx2 next Xxx2 Xxx1')
command('/^start of') command('/^start of')
@ -30,7 +30,7 @@ describe('argument list', function()
-- Write test file Xxx3 -- Write test file Xxx3
feed('$r3:.,/end of/w! Xxx3<cr>') feed('$r3:.,/end of/w! Xxx3<cr>')
wait() poke_eventloop()
-- Redefine arglist; go to Xxx1 -- Redefine arglist; go to Xxx1
command('next! Xxx1 Xxx2 Xxx3') command('next! Xxx1 Xxx2 Xxx3')
@ -43,7 +43,7 @@ describe('argument list', function()
-- Append contents of last window (Xxx1) -- Append contents of last window (Xxx1)
feed('') feed('')
wait() poke_eventloop()
command('%yank A') command('%yank A')
-- should now be in Xxx2 -- should now be in Xxx2

View File

@ -8,7 +8,7 @@ local lfs = require('lfs')
local eq = helpers.eq local eq = helpers.eq
local neq = helpers.neq local neq = helpers.neq
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local funcs = helpers.funcs local funcs = helpers.funcs
local meths = helpers.meths local meths = helpers.meths
local clear = helpers.clear local clear = helpers.clear
@ -64,7 +64,7 @@ describe("'directory' option", function()
eq(nil, lfs.attributes('.Xtest1.swp')) eq(nil, lfs.attributes('.Xtest1.swp'))
command('edit! Xtest1') command('edit! Xtest1')
wait() poke_eventloop()
eq('Xtest1', funcs.buffer_name('%')) eq('Xtest1', funcs.buffer_name('%'))
-- Verify that the swapfile exists. In the legacy test this was done by -- Verify that the swapfile exists. In the legacy test this was done by
-- reading the output from :!ls. -- reading the output from :!ls.
@ -72,7 +72,7 @@ describe("'directory' option", function()
meths.set_option('directory', './Xtest2,.') meths.set_option('directory', './Xtest2,.')
command('edit Xtest1') command('edit Xtest1')
wait() poke_eventloop()
-- swapfile should no longer exist in CWD. -- swapfile should no longer exist in CWD.
eq(nil, lfs.attributes('.Xtest1.swp')) eq(nil, lfs.attributes('.Xtest1.swp'))
@ -82,7 +82,7 @@ describe("'directory' option", function()
meths.set_option('directory', 'Xtest.je') meths.set_option('directory', 'Xtest.je')
command('edit Xtest2/Xtest3') command('edit Xtest2/Xtest3')
eq(true, curbufmeths.get_option('swapfile')) eq(true, curbufmeths.get_option('swapfile'))
wait() poke_eventloop()
eq({ "Xtest3" }, ls_dir_sorted("Xtest2")) eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
eq({ "Xtest3.swp" }, ls_dir_sorted("Xtest.je")) eq({ "Xtest3.swp" }, ls_dir_sorted("Xtest.je"))

View File

@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, insert = helpers.clear, helpers.insert local clear, insert = helpers.clear, helpers.insert
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe(':edit', function() describe(':edit', function()
setup(clear) setup(clear)
@ -13,7 +13,7 @@ describe(':edit', function()
The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar" The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar"
foo|bar foo|bar
foo/bar]]) foo/bar]])
wait() poke_eventloop()
-- Prepare some test files -- Prepare some test files
command('$-1w! Xfile1') command('$-1w! Xfile1')

View File

@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local feed, clear, command = helpers.feed, helpers.clear, helpers.command local feed, clear, command = helpers.feed, helpers.clear, helpers.command
local eq, write_file = helpers.eq, helpers.write_file local eq, write_file = helpers.eq, helpers.write_file
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('fileformats option', function() describe('fileformats option', function()
setup(function() setup(function()
@ -107,7 +107,7 @@ describe('fileformats option', function()
command('bwipe XXDosMac') command('bwipe XXDosMac')
command('e! XXEol') command('e! XXEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
wait() poke_eventloop()
command('w! XXtt54') command('w! XXtt54')
command('bwipeout! XXEol') command('bwipeout! XXEol')
command('set fileformats=dos,mac') command('set fileformats=dos,mac')
@ -116,7 +116,7 @@ describe('fileformats option', function()
command('bwipe XXUxDs') command('bwipe XXUxDs')
command('e! XXUxMac') command('e! XXUxMac')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
wait() poke_eventloop()
command('w! XXtt62') command('w! XXtt62')
command('bwipeout! XXUxMac') command('bwipeout! XXUxMac')
command('e! XXUxDsMc') command('e! XXUxDsMc')
@ -124,7 +124,7 @@ describe('fileformats option', function()
command('bwipe XXUxDsMc') command('bwipe XXUxDsMc')
command('e! XXMacEol') command('e! XXMacEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
wait() poke_eventloop()
command('w! XXtt64') command('w! XXtt64')
command('bwipeout! XXMacEol') command('bwipeout! XXMacEol')
@ -135,7 +135,7 @@ describe('fileformats option', function()
command('bwipe XXUxDsMc') command('bwipe XXUxDsMc')
command('e! XXEol') command('e! XXEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
wait() poke_eventloop()
command('w! XXtt72') command('w! XXtt72')
command('bwipeout! XXEol') command('bwipeout! XXEol')
command('set fileformats=mac,dos,unix') command('set fileformats=mac,dos,unix')
@ -144,7 +144,7 @@ describe('fileformats option', function()
command('bwipe XXUxDsMc') command('bwipe XXUxDsMc')
command('e! XXEol') command('e! XXEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
wait() poke_eventloop()
command('w! XXtt82') command('w! XXtt82')
command('bwipeout! XXEol') command('bwipeout! XXEol')
-- Try with 'binary' set. -- Try with 'binary' set.
@ -165,7 +165,7 @@ describe('fileformats option', function()
-- char was. -- char was.
command('set fileformat=unix nobin') command('set fileformat=unix nobin')
feed('ggdGaEND<esc>') feed('ggdGaEND<esc>')
wait() poke_eventloop()
command('w >>XXtt01') command('w >>XXtt01')
command('w >>XXtt02') command('w >>XXtt02')
command('w >>XXtt11') command('w >>XXtt11')
@ -204,52 +204,52 @@ describe('fileformats option', function()
command('$r XXtt01') command('$r XXtt01')
command('$r XXtt02') command('$r XXtt02')
feed('Go1<esc>') feed('Go1<esc>')
wait() poke_eventloop()
command('$r XXtt11') command('$r XXtt11')
command('$r XXtt12') command('$r XXtt12')
command('$r XXtt13') command('$r XXtt13')
feed('Go2<esc>') feed('Go2<esc>')
wait() poke_eventloop()
command('$r XXtt21') command('$r XXtt21')
command('$r XXtt22') command('$r XXtt22')
command('$r XXtt23') command('$r XXtt23')
feed('Go3<esc>') feed('Go3<esc>')
wait() poke_eventloop()
command('$r XXtt31') command('$r XXtt31')
command('$r XXtt32') command('$r XXtt32')
command('$r XXtt33') command('$r XXtt33')
feed('Go4<esc>') feed('Go4<esc>')
wait() poke_eventloop()
command('$r XXtt41') command('$r XXtt41')
command('$r XXtt42') command('$r XXtt42')
command('$r XXtt43') command('$r XXtt43')
feed('Go5<esc>') feed('Go5<esc>')
wait() poke_eventloop()
command('$r XXtt51') command('$r XXtt51')
command('$r XXtt52') command('$r XXtt52')
command('$r XXtt53') command('$r XXtt53')
command('$r XXtt54') command('$r XXtt54')
feed('Go6<esc>') feed('Go6<esc>')
wait() poke_eventloop()
command('$r XXtt61') command('$r XXtt61')
command('$r XXtt62') command('$r XXtt62')
command('$r XXtt63') command('$r XXtt63')
command('$r XXtt64') command('$r XXtt64')
feed('Go7<esc>') feed('Go7<esc>')
wait() poke_eventloop()
command('$r XXtt71') command('$r XXtt71')
command('$r XXtt72') command('$r XXtt72')
feed('Go8<esc>') feed('Go8<esc>')
wait() poke_eventloop()
command('$r XXtt81') command('$r XXtt81')
command('$r XXtt82') command('$r XXtt82')
feed('Go9<esc>') feed('Go9<esc>')
wait() poke_eventloop()
command('$r XXtt91') command('$r XXtt91')
command('$r XXtt92') command('$r XXtt92')
command('$r XXtt93') command('$r XXtt93')
feed('Go10<esc>') feed('Go10<esc>')
wait() poke_eventloop()
command('$r XXUnix') command('$r XXUnix')
command('set nobinary ff&') command('set nobinary ff&')

View File

@ -4,7 +4,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('lisp indent', function() describe('lisp indent', function()
setup(clear) setup(clear)
@ -39,7 +39,7 @@ describe('lisp indent', function()
command('set lisp') command('set lisp')
command('/^(defun') command('/^(defun')
feed('=G:/^(defun/,$yank A<cr>') feed('=G:/^(defun/,$yank A<cr>')
wait() poke_eventloop()
-- Put @a and clean empty line -- Put @a and clean empty line
command('%d') command('%d')

View File

@ -15,7 +15,7 @@ end
local function diff(text, nodedent) local function diff(text, nodedent)
local fname = helpers.tmpname() local fname = helpers.tmpname()
command('w! '..fname) command('w! '..fname)
helpers.wait() helpers.poke_eventloop()
local data = io.open(fname):read('*all') local data = io.open(fname):read('*all')
if nodedent then if nodedent then
helpers.eq(text, data) helpers.eq(text, data)

View File

@ -59,7 +59,7 @@ describe('folding', function()
feed('kYpj') feed('kYpj')
feed_command('call append("$", foldlevel("."))') feed_command('call append("$", foldlevel("."))')
helpers.wait() helpers.poke_eventloop()
screen:expect([[ screen:expect([[
dd {{{ | dd {{{ |
ee {{{ }}} | ee {{{ }}} |
@ -88,7 +88,7 @@ describe('folding', function()
feed_command('call append("$", foldlevel(2))') feed_command('call append("$", foldlevel(2))')
feed('zR') feed('zR')
helpers.wait() helpers.poke_eventloop()
screen:expect([[ screen:expect([[
aa | aa |
bb | bb |

View File

@ -5,7 +5,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed local clear, feed = helpers.clear, helpers.feed
local expect = helpers.expect local expect = helpers.expect
local eq = helpers.eq local eq = helpers.eq
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local exc_exec = helpers.exc_exec local exc_exec = helpers.exc_exec
local feed_command = helpers.feed_command local feed_command = helpers.feed_command
@ -34,7 +34,7 @@ describe(':highlight', function()
-- More --^ | -- More --^ |
]]) ]])
feed('q') feed('q')
wait() -- wait until we're back to normal poke_eventloop() -- wait until we're back to normal
feed_command('hi Search') feed_command('hi Search')
feed_command('hi Normal') feed_command('hi Normal')

View File

@ -2,8 +2,8 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local insert, command, clear, expect, eq, wait = helpers.insert, local insert, command, clear, expect, eq, poke_eventloop = helpers.insert,
helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.wait helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.poke_eventloop
local exc_exec = helpers.exc_exec local exc_exec = helpers.exc_exec
describe(':sort', function() describe(':sort', function()
@ -27,7 +27,7 @@ describe(':sort', function()
it('alphabetical', function() it('alphabetical', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort') command('sort')
expect([[ expect([[
@ -67,7 +67,7 @@ describe(':sort', function()
b321 b321
b321b b321b
]]) ]])
wait() poke_eventloop()
command('sort n') command('sort n')
expect([[ expect([[
abc abc
@ -92,7 +92,7 @@ describe(':sort', function()
it('hexadecimal', function() it('hexadecimal', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort x') command('sort x')
expect([[ expect([[
@ -114,7 +114,7 @@ describe(':sort', function()
it('alphabetical, unique', function() it('alphabetical, unique', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort u') command('sort u')
expect([[ expect([[
@ -135,7 +135,7 @@ describe(':sort', function()
it('alphabetical, reverse', function() it('alphabetical, reverse', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort!') command('sort!')
expect([[ expect([[
c321d c321d
@ -157,7 +157,7 @@ describe(':sort', function()
it('numerical, reverse', function() it('numerical, reverse', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort! n') command('sort! n')
expect([[ expect([[
b322b b322b
@ -179,7 +179,7 @@ describe(':sort', function()
it('unique, reverse', function() it('unique, reverse', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort! u') command('sort! u')
expect([[ expect([[
c321d c321d
@ -200,7 +200,7 @@ describe(':sort', function()
it('octal', function() it('octal', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort o') command('sort o')
expect([[ expect([[
abc abc
@ -222,7 +222,7 @@ describe(':sort', function()
it('reverse, hexadecimal', function() it('reverse, hexadecimal', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort! x') command('sort! x')
expect([[ expect([[
c321d c321d
@ -244,7 +244,7 @@ describe(':sort', function()
it('alphabetical, skip first character', function() it('alphabetical, skip first character', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/./') command('sort/./')
expect([[ expect([[
a a
@ -266,7 +266,7 @@ describe(':sort', function()
it('alphabetical, skip first 2 characters', function() it('alphabetical, skip first 2 characters', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/../') command('sort/../')
expect([[ expect([[
ab ab
@ -288,7 +288,7 @@ describe(':sort', function()
it('alphabetical, unique, skip first 2 characters', function() it('alphabetical, unique, skip first 2 characters', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/../u') command('sort/../u')
expect([[ expect([[
ab ab
@ -309,7 +309,7 @@ describe(':sort', function()
it('numerical, skip first character', function() it('numerical, skip first character', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/./n') command('sort/./n')
expect([[ expect([[
abc abc
@ -331,7 +331,7 @@ describe(':sort', function()
it('alphabetical, sort on first character', function() it('alphabetical, sort on first character', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/./r') command('sort/./r')
expect([[ expect([[
@ -353,7 +353,7 @@ describe(':sort', function()
it('alphabetical, sort on first 2 characters', function() it('alphabetical, sort on first 2 characters', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/../r') command('sort/../r')
expect([[ expect([[
a a
@ -375,7 +375,7 @@ describe(':sort', function()
it('numerical, sort on first character', function() it('numerical, sort on first character', function()
insert(text) insert(text)
wait() poke_eventloop()
command('sort/./rn') command('sort/./rn')
expect([[ expect([[
abc abc
@ -397,7 +397,7 @@ describe(':sort', function()
it('alphabetical, skip past first digit', function() it('alphabetical, skip past first digit', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d/]]) command([[sort/\d/]])
expect([[ expect([[
abc abc
@ -419,7 +419,7 @@ describe(':sort', function()
it('alphabetical, sort on first digit', function() it('alphabetical, sort on first digit', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d/r]]) command([[sort/\d/r]])
expect([[ expect([[
abc abc
@ -441,7 +441,7 @@ describe(':sort', function()
it('numerical, skip past first digit', function() it('numerical, skip past first digit', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d/n]]) command([[sort/\d/n]])
expect([[ expect([[
abc abc
@ -463,7 +463,7 @@ describe(':sort', function()
it('numerical, sort on first digit', function() it('numerical, sort on first digit', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d/rn]]) command([[sort/\d/rn]])
expect([[ expect([[
abc abc
@ -485,7 +485,7 @@ describe(':sort', function()
it('alphabetical, skip past first 2 digits', function() it('alphabetical, skip past first 2 digits', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d\d/]]) command([[sort/\d\d/]])
expect([[ expect([[
abc abc
@ -507,7 +507,7 @@ describe(':sort', function()
it('numerical, skip past first 2 digits', function() it('numerical, skip past first 2 digits', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d\d/n]]) command([[sort/\d\d/n]])
expect([[ expect([[
abc abc
@ -529,7 +529,7 @@ describe(':sort', function()
it('hexadecimal, skip past first 2 digits', function() it('hexadecimal, skip past first 2 digits', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d\d/x]]) command([[sort/\d\d/x]])
expect([[ expect([[
abc abc
@ -551,7 +551,7 @@ describe(':sort', function()
it('alpha, on first 2 digits', function() it('alpha, on first 2 digits', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d\d/r]]) command([[sort/\d\d/r]])
expect([[ expect([[
abc abc
@ -573,7 +573,7 @@ describe(':sort', function()
it('numeric, on first 2 digits', function() it('numeric, on first 2 digits', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d\d/rn]]) command([[sort/\d\d/rn]])
expect([[ expect([[
abc abc
@ -595,7 +595,7 @@ describe(':sort', function()
it('hexadecimal, on first 2 digits', function() it('hexadecimal, on first 2 digits', function()
insert(text) insert(text)
wait() poke_eventloop()
command([[sort/\d\d/rx]]) command([[sort/\d\d/rx]])
expect([[ expect([[
abc abc
@ -638,7 +638,7 @@ describe(':sort', function()
0b100010 0b100010
0b100100 0b100100
0b100010]]) 0b100010]])
wait() poke_eventloop()
command([[sort b]]) command([[sort b]])
expect([[ expect([[
0b000000 0b000000
@ -673,7 +673,7 @@ describe(':sort', function()
0b101010 0b101010
0b000000 0b000000
b0b111000]]) b0b111000]])
wait() poke_eventloop()
command([[sort b]]) command([[sort b]])
expect([[ expect([[
0b000000 0b000000
@ -700,7 +700,7 @@ describe(':sort', function()
1.15e-6 1.15e-6
-1.1e3 -1.1e3
-1.01e3]]) -1.01e3]])
wait() poke_eventloop()
command([[sort f]]) command([[sort f]])
expect([[ expect([[
-1.1e3 -1.1e3

View File

@ -2,9 +2,9 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local lfs = require('lfs') local lfs = require('lfs')
local clear, command, eq, neq, eval, wait = local clear, command, eq, neq, eval, poke_eventloop =
helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval, helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval,
helpers.wait helpers.poke_eventloop
describe('storing global variables in ShaDa files', function() describe('storing global variables in ShaDa files', function()
local tempname = 'Xtest-functional-legacy-074' local tempname = 'Xtest-functional-legacy-074'
@ -36,7 +36,7 @@ describe('storing global variables in ShaDa files', function()
eq(test_list, eval('MY_GLOBAL_LIST')) eq(test_list, eval('MY_GLOBAL_LIST'))
command('wsh! ' .. tempname) command('wsh! ' .. tempname)
wait() poke_eventloop()
-- Assert that the shada file exists. -- Assert that the shada file exists.
neq(nil, lfs.attributes(tempname)) neq(nil, lfs.attributes(tempname))

View File

@ -4,7 +4,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed local clear, feed = helpers.clear, helpers.feed
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('maparg()', function() describe('maparg()', function()
setup(clear) setup(clear)
@ -25,7 +25,7 @@ describe('maparg()', function()
command('map abc y<S-char-114>y') command('map abc y<S-char-114>y')
command([[call append('$', maparg('abc'))]]) command([[call append('$', maparg('abc'))]])
feed('Go<esc>:<cr>') feed('Go<esc>:<cr>')
wait() poke_eventloop()
-- Outside of the range, minimum -- Outside of the range, minimum
command('inoremap <Char-0x1040> a') command('inoremap <Char-0x1040> a')

View File

@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local clear = helpers.clear local clear = helpers.clear
local insert = helpers.insert local insert = helpers.insert
local command = helpers.command local command = helpers.command
@ -16,7 +16,7 @@ describe('107', function()
screen:attach() screen:attach()
insert('start:') insert('start:')
wait() poke_eventloop()
command('new') command('new')
command('call setline(1, range(1,256))') command('call setline(1, range(1,256))')
command('let r=[]') command('let r=[]')

View File

@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('autoformat join', function() describe('autoformat join', function()
setup(clear) setup(clear)
@ -21,7 +21,7 @@ Results:]])
feed('gg') feed('gg')
feed('0gqj<cr>') feed('0gqj<cr>')
wait() poke_eventloop()
command([[let a=string(getpos("'[")).'/'.string(getpos("']"))]]) command([[let a=string(getpos("'[")).'/'.string(getpos("']"))]])
command("g/^This line/;'}-join") command("g/^This line/;'}-join")

View File

@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq local eq = helpers.eq
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local eval = helpers.eval local eval = helpers.eval
local feed = helpers.feed local feed = helpers.feed
local clear = helpers.clear local clear = helpers.clear
@ -110,23 +110,23 @@ describe('close_count', function()
command('for i in range(5)|new|endfor') command('for i in range(5)|new|endfor')
command('4wincmd w') command('4wincmd w')
feed('<C-W>c<cr>') feed('<C-W>c<cr>')
wait() poke_eventloop()
command('let buffers = []') command('let buffers = []')
command('windo call add(buffers, bufnr("%"))') command('windo call add(buffers, bufnr("%"))')
eq({25, 24, 23, 21, 1}, eval('buffers')) eq({25, 24, 23, 21, 1}, eval('buffers'))
feed('1<C-W>c<cr>') feed('1<C-W>c<cr>')
wait() poke_eventloop()
command('let buffers = []') command('let buffers = []')
command('windo call add(buffers, bufnr("%"))') command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21, 1}, eval('buffers')) eq({24, 23, 21, 1}, eval('buffers'))
feed('9<C-W>c<cr>') feed('9<C-W>c<cr>')
wait() poke_eventloop()
command('let buffers = []') command('let buffers = []')
command('windo call add(buffers, bufnr("%"))') command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21}, eval('buffers')) eq({24, 23, 21}, eval('buffers'))
command('1wincmd w') command('1wincmd w')
feed('2<C-W>c<cr>') feed('2<C-W>c<cr>')
wait() poke_eventloop()
command('let buffers = []') command('let buffers = []')
command('windo call add(buffers, bufnr("%"))') command('windo call add(buffers, bufnr("%"))')
eq({24, 21}, eval('buffers')) eq({24, 21}, eval('buffers'))

View File

@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
local clear = helpers.clear local clear = helpers.clear
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local feed = helpers.feed local feed = helpers.feed
local feed_command = helpers.feed_command local feed_command = helpers.feed_command
@ -18,7 +18,7 @@ describe('display', function()
}) })
feed_command([[call setline(1, repeat('a', 21))]]) feed_command([[call setline(1, repeat('a', 21))]])
wait() poke_eventloop()
feed('O') feed('O')
screen:expect([[ screen:expect([[
^ | ^ |

View File

@ -4,7 +4,7 @@ local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, command, expect = helpers.clear, helpers.command, helpers.expect local clear, command, expect = helpers.clear, helpers.command, helpers.expect
local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local exc_exec = helpers.exc_exec local exc_exec = helpers.exc_exec
local dedent = helpers.dedent local dedent = helpers.dedent
@ -71,7 +71,7 @@ describe('eval', function()
command([[call SetReg('I', 'abcI')]]) command([[call SetReg('I', 'abcI')]])
feed('Go{{{1 Appending single lines with setreg()<esc>') feed('Go{{{1 Appending single lines with setreg()<esc>')
wait() poke_eventloop()
command([[call SetReg('A', 'abcAc', 'c')]]) command([[call SetReg('A', 'abcAc', 'c')]])
command([[call SetReg('A', 'abcAl', 'l')]]) command([[call SetReg('A', 'abcAl', 'l')]])
command([[call SetReg('A', 'abcAc2','c')]]) command([[call SetReg('A', 'abcAc2','c')]])
@ -700,13 +700,13 @@ describe('eval', function()
start:]]) start:]])
command('/^012345678') command('/^012345678')
feed('6l') feed('6l')
wait() poke_eventloop()
command('let sp = getcurpos()') command('let sp = getcurpos()')
feed('0') feed('0')
wait() poke_eventloop()
command("call setpos('.', sp)") command("call setpos('.', sp)")
feed('jyl') feed('jyl')
wait() poke_eventloop()
command('$put') command('$put')
expect([[ expect([[
012345678 012345678

View File

@ -2,7 +2,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local feed_command, expect, wait = helpers.feed_command, helpers.expect, helpers.wait local feed_command, expect, poke_eventloop = helpers.feed_command, helpers.expect, helpers.poke_eventloop
describe('mapping', function() describe('mapping', function()
before_each(clear) before_each(clear)
@ -29,9 +29,9 @@ describe('mapping', function()
feed_command('cunmap <c-c>') feed_command('cunmap <c-c>')
feed('GA<cr>') feed('GA<cr>')
feed('TEST2: CTRL-C |') feed('TEST2: CTRL-C |')
wait() poke_eventloop()
feed('<c-c>A|<cr><esc>') feed('<c-c>A|<cr><esc>')
wait() poke_eventloop()
feed_command('unmap <c-c>') feed_command('unmap <c-c>')
feed_command('unmap! <c-c>') feed_command('unmap! <c-c>')
@ -46,7 +46,7 @@ describe('mapping', function()
feed('GV') feed('GV')
-- XXX: For some reason the mapping is only triggered -- XXX: For some reason the mapping is only triggered
-- when <C-c> is in a separate feed command. -- when <C-c> is in a separate feed command.
wait() poke_eventloop()
feed('<c-c>') feed('<c-c>')
feed_command('vunmap <c-c>') feed_command('vunmap <c-c>')

View File

@ -7,7 +7,7 @@ local iswin = helpers.iswin
local retry = helpers.retry local retry = helpers.retry
local ok = helpers.ok local ok = helpers.ok
local source = helpers.source local source = helpers.source
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local uname = helpers.uname local uname = helpers.uname
local load_adjust = helpers.load_adjust local load_adjust = helpers.load_adjust
@ -102,7 +102,7 @@ describe('memory usage', function()
call s:f(0) call s:f(0)
endfor endfor
]]) ]])
wait() poke_eventloop()
local after = monitor_memory_usage(pid) local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage. -- Estimate the limit of max usage as 2x initial usage.
-- The lower limit can fluctuate a bit, use 97%. -- The lower limit can fluctuate a bit, use 97%.
@ -147,11 +147,11 @@ describe('memory usage', function()
call s:f() call s:f()
endfor endfor
]]) ]])
wait() poke_eventloop()
local after = monitor_memory_usage(pid) local after = monitor_memory_usage(pid)
for _ = 1, 3 do for _ = 1, 3 do
feed_command('so '..fname) feed_command('so '..fname)
wait() poke_eventloop()
end end
local last = monitor_memory_usage(pid) local last = monitor_memory_usage(pid)
-- The usage may be a bit less than the last value, use 80%. -- The usage may be a bit less than the last value, use 80%.

View File

@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local clear = helpers.clear local clear = helpers.clear
local insert = helpers.insert local insert = helpers.insert
local expect = helpers.expect local expect = helpers.expect
@ -15,7 +15,7 @@ describe('search_mbyte', function()
Test bce: Test bce:
]=]) ]=])
wait() poke_eventloop()
command('/^Test bce:/+1') command('/^Test bce:/+1')
command([[$put =search('', 'bce', line('.'))]]) command([[$put =search('', 'bce', line('.'))]])

View File

@ -6,7 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval local eval = helpers.eval
local feed = helpers.feed local feed = helpers.feed
local funcs = helpers.funcs local funcs = helpers.funcs
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('search cmdline', function() describe('search cmdline', function()
local screen local screen
@ -483,9 +483,9 @@ describe('search cmdline', function()
-- "interactive". This mimics Vim's test_override("char_avail"). -- "interactive". This mimics Vim's test_override("char_avail").
-- (See legacy test: test_search.vim) -- (See legacy test: test_search.vim)
feed('?the') feed('?the')
wait() poke_eventloop()
feed('<c-g>') feed('<c-g>')
wait() poke_eventloop()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
1 the first | 1 the first |
@ -496,11 +496,11 @@ describe('search cmdline', function()
command('$') command('$')
feed('?the') feed('?the')
wait() poke_eventloop()
feed('<c-g>') feed('<c-g>')
wait() poke_eventloop()
feed('<c-g>') feed('<c-g>')
wait() poke_eventloop()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
1 ^the first | 1 ^the first |
@ -511,13 +511,13 @@ describe('search cmdline', function()
command('$') command('$')
feed('?the') feed('?the')
wait() poke_eventloop()
feed('<c-g>') feed('<c-g>')
wait() poke_eventloop()
feed('<c-g>') feed('<c-g>')
wait() poke_eventloop()
feed('<c-g>') feed('<c-g>')
wait() poke_eventloop()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
1 the first | 1 the first |
@ -528,9 +528,9 @@ describe('search cmdline', function()
command('$') command('$')
feed('?the') feed('?the')
wait() poke_eventloop()
feed('<c-t>') feed('<c-t>')
wait() poke_eventloop()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
1 ^the first | 1 ^the first |
@ -541,11 +541,11 @@ describe('search cmdline', function()
command('$') command('$')
feed('?the') feed('?the')
wait() poke_eventloop()
feed('<c-t>') feed('<c-t>')
wait() poke_eventloop()
feed('<c-t>') feed('<c-t>')
wait() poke_eventloop()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
1 the first | 1 the first |
@ -556,13 +556,13 @@ describe('search cmdline', function()
command('$') command('$')
feed('?the') feed('?the')
wait() poke_eventloop()
feed('<c-t>') feed('<c-t>')
wait() poke_eventloop()
feed('<c-t>') feed('<c-t>')
wait() poke_eventloop()
feed('<c-t>') feed('<c-t>')
wait() poke_eventloop()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
1 the first | 1 the first |

View File

@ -5,7 +5,7 @@ local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
local eq, eval = helpers.eq, helpers.eval local eq, eval = helpers.eq, helpers.eval
local source = helpers.source local source = helpers.source
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('utf8', function() describe('utf8', function()
before_each(clear) before_each(clear)
@ -18,7 +18,7 @@ describe('utf8', function()
-- Visual block Insert adjusts for multi-byte char -- Visual block Insert adjusts for multi-byte char
feed('gg0l<C-V>jjIx<Esc>') feed('gg0l<C-V>jjIx<Esc>')
wait() poke_eventloop()
command('let r = getline(1, "$")') command('let r = getline(1, "$")')
command('bwipeout!') command('bwipeout!')

View File

@ -4,7 +4,7 @@ local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, command = helpers.clear, helpers.command local clear, command = helpers.clear, helpers.command
local eq, eval = helpers.eq, helpers.eval local eq, eval = helpers.eq, helpers.eval
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('wordcount', function() describe('wordcount', function()
before_each(clear) before_each(clear)
@ -14,7 +14,7 @@ describe('wordcount', function()
insert([=[ insert([=[
RESULT test:]=]) RESULT test:]=])
wait() poke_eventloop()
command('new') command('new')
source([=[ source([=[
@ -127,7 +127,7 @@ describe('wordcount', function()
-- -- Start visual mode quickly and select complete buffer. -- -- Start visual mode quickly and select complete buffer.
command('0') command('0')
feed('V2jy<cr>') feed('V2jy<cr>')
wait() poke_eventloop()
command('set stl= ls=1') command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])') command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat') command('let log[1]=g:visual_stat')
@ -144,7 +144,7 @@ describe('wordcount', function()
-- Start visual mode quickly and select complete buffer. -- Start visual mode quickly and select complete buffer.
command('0') command('0')
feed('v$y<cr>') feed('v$y<cr>')
wait() poke_eventloop()
command('set stl= ls=1') command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])') command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat') command('let log[1]=g:visual_stat')
@ -161,7 +161,7 @@ describe('wordcount', function()
-- Start visual mode quickly and select complete buffer. -- Start visual mode quickly and select complete buffer.
command('2') command('2')
feed('0v$y<cr>') feed('0v$y<cr>')
wait() poke_eventloop()
command('set stl= ls=1') command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])') command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat') command('let log[1]=g:visual_stat')

View File

@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers') local thelpers = require('test.functional.terminal.helpers')
local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source
local eq, neq = helpers.eq, helpers.neq local eq, neq = helpers.eq, helpers.neq
local write_file = helpers.write_file local write_file = helpers.write_file
@ -13,7 +13,7 @@ describe(':terminal buffer', function()
before_each(function() before_each(function()
clear() clear()
feed_command('set modifiable swapfile undolevels=20') feed_command('set modifiable swapfile undolevels=20')
wait() poke_eventloop()
screen = thelpers.screen_setup() screen = thelpers.screen_setup()
end) end)

View File

@ -70,7 +70,7 @@ describe(':terminal cursor', function()
:set number | :set number |
]]) ]])
feed('i') feed('i')
helpers.wait() helpers.poke_eventloop()
screen:expect([[ screen:expect([[
{7: 1 }tty ready | {7: 1 }tty ready |
{7: 2 }rows: 6, cols: 46 | {7: 2 }rows: 6, cols: 46 |

View File

@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
local clear, wait, nvim = helpers.clear, helpers.wait, helpers.nvim local clear, poke_eventloop, nvim = helpers.clear, helpers.poke_eventloop, helpers.nvim
local nvim_dir, source, eq = helpers.nvim_dir, helpers.source, helpers.eq local nvim_dir, source, eq = helpers.nvim_dir, helpers.source, helpers.eq
local feed = helpers.feed local feed = helpers.feed
local feed_command, eval = helpers.feed_command, helpers.eval local feed_command, eval = helpers.feed_command, helpers.eval
@ -29,7 +29,7 @@ describe(':terminal', function()
-- Invoke a command that emits frequent terminal activity. -- Invoke a command that emits frequent terminal activity.
feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 9999 !terminal_output!<cr>]]) feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 9999 !terminal_output!<cr>]])
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
wait() poke_eventloop()
-- Wait for some terminal activity. -- Wait for some terminal activity.
retry(nil, 4000, function() retry(nil, 4000, function()
ok(funcs.line('$') > 6) ok(funcs.line('$') > 6)
@ -60,7 +60,7 @@ describe(':terminal', function()
feed_command([[terminal while true; do echo foo; sleep .1; done]]) feed_command([[terminal while true; do echo foo; sleep .1; done]])
end end
feed([[<C-\><C-N>M]]) -- move cursor away from last line feed([[<C-\><C-N>M]]) -- move cursor away from last line
wait() poke_eventloop()
eq(3, eval("line('$')")) -- window height eq(3, eval("line('$')")) -- window height
eq(2, eval("line('.')")) -- cursor is in the middle eq(2, eval("line('.')")) -- cursor is in the middle
feed_command('vsplit') feed_command('vsplit')
@ -76,11 +76,11 @@ describe(':terminal', function()
-- Create a new line (in the shell). For a normal buffer this -- Create a new line (in the shell). For a normal buffer this
-- increments the jumplist; for a terminal-buffer it should not. #3723 -- increments the jumplist; for a terminal-buffer it should not. #3723
feed('i') feed('i')
wait() poke_eventloop()
feed('<CR><CR><CR><CR>') feed('<CR><CR><CR><CR>')
wait() poke_eventloop()
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
wait() poke_eventloop()
-- Wait for >=1 lines to be created. -- Wait for >=1 lines to be created.
retry(nil, 4000, function() retry(nil, 4000, function()
ok(funcs.line('$') > lines_before) ok(funcs.line('$') > lines_before)
@ -210,7 +210,7 @@ describe(':terminal (with fake shell)', function()
it('ignores writes if the backing stream closes', function() it('ignores writes if the backing stream closes', function()
terminal_with_fake_shell() terminal_with_fake_shell()
feed('iiXXXXXXX') feed('iiXXXXXXX')
wait() poke_eventloop()
-- Race: Though the shell exited (and streams were closed by SIGCHLD -- Race: Though the shell exited (and streams were closed by SIGCHLD
-- handler), :terminal cleanup is pending on the main-loop. -- handler), :terminal cleanup is pending on the main-loop.
-- This write should be ignored (not crash, #5445). -- This write should be ignored (not crash, #5445).

View File

@ -6,7 +6,7 @@ local feed, nvim_dir, feed_command = helpers.feed, helpers.nvim_dir, helpers.fee
local iswin = helpers.iswin local iswin = helpers.iswin
local eval = helpers.eval local eval = helpers.eval
local command = helpers.command local command = helpers.command
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local retry = helpers.retry local retry = helpers.retry
local curbufmeths = helpers.curbufmeths local curbufmeths = helpers.curbufmeths
local nvim = helpers.nvim local nvim = helpers.nvim
@ -347,7 +347,7 @@ describe(':terminal prints more lines than the screen height and exits', functio
local screen = Screen.new(30, 7) local screen = Screen.new(30, 7)
screen:attach({rgb=false}) screen:attach({rgb=false})
feed_command('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert') feed_command('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert')
wait() poke_eventloop()
screen:expect([[ screen:expect([[
line6 | line6 |
line7 | line7 |
@ -423,7 +423,7 @@ describe("'scrollback' option", function()
retry(nil, nil, function() expect_lines(33, 2) end) retry(nil, nil, function() expect_lines(33, 2) end)
curbufmeths.set_option('scrollback', 10) curbufmeths.set_option('scrollback', 10)
wait() poke_eventloop()
retry(nil, nil, function() expect_lines(16) end) retry(nil, nil, function() expect_lines(16) end)
curbufmeths.set_option('scrollback', 10000) curbufmeths.set_option('scrollback', 10000)
retry(nil, nil, function() expect_lines(16) end) retry(nil, nil, function() expect_lines(16) end)

View File

@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers') local thelpers = require('test.functional.terminal.helpers')
local feed_data = thelpers.feed_data local feed_data = thelpers.feed_data
local feed, clear = helpers.feed, helpers.clear local feed, clear = helpers.feed, helpers.clear
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local iswin = helpers.iswin local iswin = helpers.iswin
local command = helpers.command local command = helpers.command
local retry = helpers.retry local retry = helpers.retry
@ -127,7 +127,7 @@ describe(':terminal window', function()
it('wont show any folds', function() it('wont show any folds', function()
feed([[<C-\><C-N>ggvGzf]]) feed([[<C-\><C-N>ggvGzf]])
wait() poke_eventloop()
screen:expect([[ screen:expect([[
^tty ready | ^tty ready |
line1 | line1 |

View File

@ -14,7 +14,7 @@ local neq = helpers.neq
local ok = helpers.ok local ok = helpers.ok
local retry = helpers.retry local retry = helpers.retry
local source = helpers.source local source = helpers.source
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
local nvim = helpers.nvim local nvim = helpers.nvim
local sleep = helpers.sleep local sleep = helpers.sleep
local nvim_dir = helpers.nvim_dir local nvim_dir = helpers.nvim_dir
@ -114,7 +114,7 @@ describe(":substitute, inccommand=split interactivity", function()
it("no preview if invoked by a script", function() it("no preview if invoked by a script", function()
source('%s/tw/MO/g') source('%s/tw/MO/g')
wait() poke_eventloop()
eq(1, eval("bufnr('$')")) eq(1, eval("bufnr('$')"))
-- sanity check: assert the buffer state -- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO")) expect(default_text:gsub("tw", "MO"))
@ -123,10 +123,10 @@ describe(":substitute, inccommand=split interactivity", function()
it("no preview if invoked by feedkeys()", function() it("no preview if invoked by feedkeys()", function()
-- in a script... -- in a script...
source([[:call feedkeys(":%s/tw/MO/g\<CR>")]]) source([[:call feedkeys(":%s/tw/MO/g\<CR>")]])
wait() poke_eventloop()
-- or interactively... -- or interactively...
feed([[:call feedkeys(":%s/tw/MO/g\<CR>")<CR>]]) feed([[:call feedkeys(":%s/tw/MO/g\<CR>")<CR>]])
wait() poke_eventloop()
eq(1, eval("bufnr('$')")) eq(1, eval("bufnr('$')"))
-- sanity check: assert the buffer state -- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO")) expect(default_text:gsub("tw", "MO"))
@ -194,7 +194,7 @@ describe(":substitute, 'inccommand' preserves", function()
-- Start typing an incomplete :substitute command. -- Start typing an incomplete :substitute command.
feed([[:%s/e/YYYY/g]]) feed([[:%s/e/YYYY/g]])
wait() poke_eventloop()
-- Cancel the :substitute. -- Cancel the :substitute.
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
@ -230,7 +230,7 @@ describe(":substitute, 'inccommand' preserves", function()
-- Start typing an incomplete :substitute command. -- Start typing an incomplete :substitute command.
feed([[:%s/e/YYYY/g]]) feed([[:%s/e/YYYY/g]])
wait() poke_eventloop()
-- Cancel the :substitute. -- Cancel the :substitute.
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
@ -251,7 +251,7 @@ describe(":substitute, 'inccommand' preserves", function()
some text 1 some text 1
some text 2]]) some text 2]])
feed(":%s/e/XXX/") feed(":%s/e/XXX/")
wait() poke_eventloop()
eq(expected_tick, eval("b:changedtick")) eq(expected_tick, eval("b:changedtick"))
end) end)
@ -1128,15 +1128,15 @@ describe(":substitute, inccommand=split", function()
feed(":%s/tw/Xo/g") feed(":%s/tw/Xo/g")
-- Delete and re-type the g a few times. -- Delete and re-type the g a few times.
feed("<BS>") feed("<BS>")
wait() poke_eventloop()
feed("g") feed("g")
wait() poke_eventloop()
feed("<BS>") feed("<BS>")
wait() poke_eventloop()
feed("g") feed("g")
wait() poke_eventloop()
feed("<CR>") feed("<CR>")
wait() poke_eventloop()
feed(":vs tmp<enter>") feed(":vs tmp<enter>")
eq(3, helpers.call('bufnr', '$')) eq(3, helpers.call('bufnr', '$'))
end) end)
@ -1171,7 +1171,7 @@ describe(":substitute, inccommand=split", function()
feed_command("silent edit! test/functional/fixtures/bigfile_oneline.txt") feed_command("silent edit! test/functional/fixtures/bigfile_oneline.txt")
-- Start :substitute with a slow pattern. -- Start :substitute with a slow pattern.
feed([[:%s/B.*N/x]]) feed([[:%s/B.*N/x]])
wait() poke_eventloop()
-- Assert that 'inccommand' is DISABLED in cmdline mode. -- Assert that 'inccommand' is DISABLED in cmdline mode.
eq("", eval("&inccommand")) eq("", eval("&inccommand"))
@ -1360,7 +1360,7 @@ describe("inccommand=nosplit", function()
feed("<Esc>") feed("<Esc>")
command("set icm=nosplit") command("set icm=nosplit")
feed(":%s/tw/OKOK") feed(":%s/tw/OKOK")
wait() poke_eventloop()
screen:expect([[ screen:expect([[
Inc substitution on | Inc substitution on |
{12:OKOK}o lines | {12:OKOK}o lines |
@ -2592,7 +2592,7 @@ describe(":substitute", function()
feed("<C-c>") feed("<C-c>")
feed('gg') feed('gg')
wait() poke_eventloop()
feed([[:%s/\(some\)\@<lt>!thing/one/]]) feed([[:%s/\(some\)\@<lt>!thing/one/]])
screen:expect([[ screen:expect([[
something | something |
@ -2613,7 +2613,7 @@ describe(":substitute", function()
]]) ]])
feed([[<C-c>]]) feed([[<C-c>]])
wait() poke_eventloop()
feed([[:%s/some\(thing\)\@=/every/]]) feed([[:%s/some\(thing\)\@=/every/]])
screen:expect([[ screen:expect([[
{12:every}thing | {12:every}thing |
@ -2634,7 +2634,7 @@ describe(":substitute", function()
]]) ]])
feed([[<C-c>]]) feed([[<C-c>]])
wait() poke_eventloop()
feed([[:%s/some\(thing\)\@!/every/]]) feed([[:%s/some\(thing\)\@!/every/]])
screen:expect([[ screen:expect([[
something | something |
@ -2718,7 +2718,7 @@ it(':substitute with inccommand during :terminal activity', function()
feed('gg') feed('gg')
feed(':%s/foo/ZZZ') feed(':%s/foo/ZZZ')
sleep(20) -- Allow some terminal activity. sleep(20) -- Allow some terminal activity.
helpers.wait() helpers.poke_eventloop()
screen:expect_unchanged() screen:expect_unchanged()
end) end)
end) end)

View File

@ -546,7 +546,7 @@ describe('ui/mouse/input', function()
:tabprevious | :tabprevious |
]]) ]])
feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab
helpers.wait() helpers.poke_eventloop()
feed('<LeftMouse><0,1>') feed('<LeftMouse><0,1>')
screen:expect([[ screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}| {tab: + foo }{sel: + bar }{fill: }{tab:X}|

View File

@ -4,7 +4,7 @@ local clear = helpers.clear
local feed, command, insert = helpers.feed, helpers.command, helpers.insert local feed, command, insert = helpers.feed, helpers.command, helpers.insert
local eq = helpers.eq local eq = helpers.eq
local meths = helpers.meths local meths = helpers.meths
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('ext_multigrid', function() describe('ext_multigrid', function()
@ -1846,8 +1846,8 @@ describe('ext_multigrid', function()
meths.input_mouse('left', 'press', '', 1,6, 20) meths.input_mouse('left', 'press', '', 1,6, 20)
-- TODO(bfredl): "batching" input_mouse is formally not supported yet. -- TODO(bfredl): "batching" input_mouse is formally not supported yet.
-- Normally it should work fine in async context when nvim is not blocked, -- Normally it should work fine in async context when nvim is not blocked,
-- but add a wait be sure. -- but add a poke_eventloop be sure.
wait() poke_eventloop()
meths.input_mouse('left', 'drag', '', 1, 4, 20) meths.input_mouse('left', 'drag', '', 1, 4, 20)
screen:expect{grid=[[ screen:expect{grid=[[
## grid 1 ## grid 1
@ -1921,7 +1921,7 @@ describe('ext_multigrid', function()
]]} ]]}
meths.input_mouse('left', 'press', '', 1,8, 26) meths.input_mouse('left', 'press', '', 1,8, 26)
wait() poke_eventloop()
meths.input_mouse('left', 'drag', '', 1, 6, 30) meths.input_mouse('left', 'drag', '', 1, 6, 30)
screen:expect{grid=[[ screen:expect{grid=[[
## grid 1 ## grid 1

View File

@ -158,7 +158,7 @@ describe('search highlighting', function()
bar foo baz bar foo baz
]]) ]])
feed('/foo') feed('/foo')
helpers.wait() helpers.poke_eventloop()
screen:expect_unchanged() screen:expect_unchanged()
end) end)

View File

@ -6,7 +6,7 @@ local feed_command, source, expect = helpers.feed_command, helpers.source, helpe
local curbufmeths = helpers.curbufmeths local curbufmeths = helpers.curbufmeths
local command = helpers.command local command = helpers.command
local meths = helpers.meths local meths = helpers.meths
local wait = helpers.wait local poke_eventloop = helpers.poke_eventloop
describe('completion', function() describe('completion', function()
local screen local screen
@ -737,8 +737,8 @@ describe('completion', function()
-- Does not indent when "ind" is typed. -- Does not indent when "ind" is typed.
feed("in<C-X><C-N>") feed("in<C-X><C-N>")
-- Completion list is generated incorrectly if we send everything at once -- Completion list is generated incorrectly if we send everything at once
-- via nvim_input(). So wait() before sending <BS>. #8480 -- via nvim_input(). So poke_eventloop() before sending <BS>. #8480
wait() poke_eventloop()
feed("<BS>d") feed("<BS>d")
screen:expect([[ screen:expect([[
@ -778,7 +778,7 @@ describe('completion', function()
]]) ]])
-- Works for unindenting too. -- Works for unindenting too.
feed("ounin<C-X><C-N>") feed("ounin<C-X><C-N>")
helpers.wait() helpers.poke_eventloop()
feed("<BS>d") feed("<BS>d")
screen:expect([[ screen:expect([[
inc uninc indent unindent | inc uninc indent unindent |
@ -1000,65 +1000,65 @@ describe('completion', function()
command('let g:foo = []') command('let g:foo = []')
feed('o') feed('o')
wait() poke_eventloop()
feed('<esc>') feed('<esc>')
eq({'I'}, eval('g:foo')) eq({'I'}, eval('g:foo'))
command('let g:foo = []') command('let g:foo = []')
feed('S') feed('S')
wait() poke_eventloop()
feed('f') feed('f')
wait() poke_eventloop()
eq({'I', 'I'}, eval('g:foo')) eq({'I', 'I'}, eval('g:foo'))
feed('<esc>') feed('<esc>')
command('let g:foo = []') command('let g:foo = []')
feed('S') feed('S')
wait() poke_eventloop()
feed('f') feed('f')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
eq({'I', 'I', 'P'}, eval('g:foo')) eq({'I', 'I', 'P'}, eval('g:foo'))
feed('<esc>') feed('<esc>')
command('let g:foo = []') command('let g:foo = []')
feed('S') feed('S')
wait() poke_eventloop()
feed('f') feed('f')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
eq({'I', 'I', 'P', 'P'}, eval('g:foo')) eq({'I', 'I', 'P', 'P'}, eval('g:foo'))
feed('<esc>') feed('<esc>')
command('let g:foo = []') command('let g:foo = []')
feed('S') feed('S')
wait() poke_eventloop()
feed('f') feed('f')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
eq({'I', 'I', 'P', 'P', 'P'}, eval('g:foo')) eq({'I', 'I', 'P', 'P', 'P'}, eval('g:foo'))
feed('<esc>') feed('<esc>')
command('let g:foo = []') command('let g:foo = []')
feed('S') feed('S')
wait() poke_eventloop()
feed('f') feed('f')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
wait() poke_eventloop()
feed('<C-N>') feed('<C-N>')
eq({'I', 'I', 'P', 'P', 'P', 'P'}, eval('g:foo')) eq({'I', 'I', 'P', 'P', 'P', 'P'}, eval('g:foo'))
feed('<esc>') feed('<esc>')