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:~ }|
{1:very fail} |
]])
helpers.wait()
helpers.poke_eventloop()
-- shows up to &cmdheight lines
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,
helpers.curbuf_contents, helpers.window, helpers.curwin, helpers.eq,
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 funcs = helpers.funcs
local request = helpers.request
@ -82,7 +82,7 @@ describe('API/win', function()
insert("epilogue")
local win = curwin()
feed('gg')
wait() -- let nvim process the 'gg' command
poke_eventloop() -- let nvim process the 'gg' command
-- cursor position is at beginning
eq({1, 0}, window('get_cursor', win))
@ -128,7 +128,7 @@ describe('API/win', function()
insert("second line")
feed('gg')
wait() -- let nvim process the 'gg' command
poke_eventloop() -- let nvim process the 'gg' command
-- cursor position is at beginning
local win = curwin()
@ -139,7 +139,7 @@ describe('API/win', function()
-- move down a line
feed('j')
wait() -- let nvim process the 'j' command
poke_eventloop() -- let nvim process the 'j' command
-- cursor is still in column 5
eq({2, 5}, window('get_cursor', win))

View File

@ -8,7 +8,7 @@ local run = helpers.run
local funcs = helpers.funcs
local nvim_prog = helpers.nvim_prog
local redir_exec = helpers.redir_exec
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('v:exiting', function()
local cid
@ -52,7 +52,7 @@ describe(':cquit', function()
local function test_cq(cmdline, exit_code, redir_msg)
if redir_msg then
eq('\n' .. redir_msg, redir_exec(cmdline))
wait()
poke_eventloop()
eq(2, eval("1+1")) -- Still alive?
else
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 meths = helpers.meths
local NIL = helpers.NIL
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local iswin = helpers.iswin
local get_pathsep = helpers.get_pathsep
local pathroot = helpers.pathroot
@ -428,7 +428,7 @@ describe('jobs', function()
\ }
let job = jobstart(['cat', '-'], g:callbacks)
]])
wait()
poke_eventloop()
source([[
function! g:JobHandler(job_id, data, event)
endfunction

View File

@ -4,7 +4,7 @@ local command = helpers.command
local meths = helpers.meths
local clear = helpers.clear
local sleep = helpers.sleep
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local feed = helpers.feed
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>')
sleep(min_dur / 16 * 1000)
feed('<C-c>')
wait()
poke_eventloop()
command('let t_dur = reltimestr(reltime(t_rt))')
local t_dur = tonumber(meths.get_var('t_dur'))
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>')
sleep(min_dur / 16 * 1000)
feed('<C-c>')
wait()
poke_eventloop()
command('let t_dur = reltimestr(reltime(t_rt))')
local t_dur = tonumber(meths.get_var('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 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 eval = helpers.eval
@ -90,7 +90,7 @@ describe(':browse oldfiles', function()
feed_command('edit testfile2')
filename2 = buf.get_name()
feed_command('wshada')
wait()
poke_eventloop()
_clear()
-- Ensure nvim is out of "Press ENTER..." prompt.

View File

@ -554,9 +554,9 @@ function module.curbuf(method, ...)
return module.buffer(method, 0, ...)
end
function module.wait()
-- Execute 'nvim_eval' (a deferred function) to block
-- until all pending input is processed.
function module.poke_eventloop()
-- Execute 'nvim_eval' (a deferred function) to
-- force at least one main_loop iteration
session:request('nvim_eval', '1')
end
@ -566,7 +566,7 @@ end
--@see buf_lines()
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')
end

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 command, expect = helpers.command, helpers.expect
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('test5', function()
setup(clear)
@ -34,7 +34,7 @@ describe('test5', function()
command('bwipe')
feed('G?this is a<cr>')
feed('othis is some more text<esc>')
wait()
poke_eventloop()
-- Append some text to this file.
@ -45,7 +45,7 @@ describe('test5', function()
command('bwipe!')
-- Append an extra line to the output register.
feed('ithis is another test line<esc>:yank A<cr>')
wait()
poke_eventloop()
-- Output results
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 command, dedent, eq = helpers.command, helpers.dedent, helpers.eq
local curbuf_contents = helpers.curbuf_contents
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('argument list', function()
setup(clear)
@ -17,7 +17,7 @@ describe('argument list', function()
this is a test
this is a test
end of test file Xxx]])
wait()
poke_eventloop()
command('au BufReadPost Xxx2 next Xxx2 Xxx1')
command('/^start of')
@ -30,7 +30,7 @@ describe('argument list', function()
-- Write test file Xxx3
feed('$r3:.,/end of/w! Xxx3<cr>')
wait()
poke_eventloop()
-- Redefine arglist; go to Xxx1
command('next! Xxx1 Xxx2 Xxx3')
@ -43,7 +43,7 @@ describe('argument list', function()
-- Append contents of last window (Xxx1)
feed('')
wait()
poke_eventloop()
command('%yank A')
-- should now be in Xxx2

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
local expect = helpers.expect
local eq = helpers.eq
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local exc_exec = helpers.exc_exec
local feed_command = helpers.feed_command
@ -34,7 +34,7 @@ describe(':highlight', function()
-- More --^ |
]])
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 Normal')

View File

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

View File

@ -2,9 +2,9 @@
local helpers = require('test.functional.helpers')(after_each)
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.wait
helpers.poke_eventloop
describe('storing global variables in ShaDa files', function()
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'))
command('wsh! ' .. tempname)
wait()
poke_eventloop()
-- Assert that the shada file exists.
neq(nil, lfs.attributes(tempname))

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
@ -110,23 +110,23 @@ describe('close_count', function()
command('for i in range(5)|new|endfor')
command('4wincmd w')
feed('<C-W>c<cr>')
wait()
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({25, 24, 23, 21, 1}, eval('buffers'))
feed('1<C-W>c<cr>')
wait()
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21, 1}, eval('buffers'))
feed('9<C-W>c<cr>')
wait()
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21}, eval('buffers'))
command('1wincmd w')
feed('2<C-W>c<cr>')
wait()
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
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 clear = helpers.clear
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local feed = helpers.feed
local feed_command = helpers.feed_command
@ -18,7 +18,7 @@ describe('display', function()
})
feed_command([[call setline(1, repeat('a', 21))]])
wait()
poke_eventloop()
feed('O')
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 clear, command, expect = helpers.clear, helpers.command, helpers.expect
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 dedent = helpers.dedent
@ -71,7 +71,7 @@ describe('eval', function()
command([[call SetReg('I', 'abcI')]])
feed('Go{{{1 Appending single lines with setreg()<esc>')
wait()
poke_eventloop()
command([[call SetReg('A', 'abcAc', 'c')]])
command([[call SetReg('A', 'abcAl', 'l')]])
command([[call SetReg('A', 'abcAc2','c')]])
@ -700,13 +700,13 @@ describe('eval', function()
start:]])
command('/^012345678')
feed('6l')
wait()
poke_eventloop()
command('let sp = getcurpos()')
feed('0')
wait()
poke_eventloop()
command("call setpos('.', sp)")
feed('jyl')
wait()
poke_eventloop()
command('$put')
expect([[
012345678

View File

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

View File

@ -7,7 +7,7 @@ local iswin = helpers.iswin
local retry = helpers.retry
local ok = helpers.ok
local source = helpers.source
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local uname = helpers.uname
local load_adjust = helpers.load_adjust
@ -102,7 +102,7 @@ describe('memory usage', function()
call s:f(0)
endfor
]])
wait()
poke_eventloop()
local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage.
-- The lower limit can fluctuate a bit, use 97%.
@ -147,11 +147,11 @@ describe('memory usage', function()
call s:f()
endfor
]])
wait()
poke_eventloop()
local after = monitor_memory_usage(pid)
for _ = 1, 3 do
feed_command('so '..fname)
wait()
poke_eventloop()
end
local last = monitor_memory_usage(pid)
-- 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 wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local clear = helpers.clear
local insert = helpers.insert
local expect = helpers.expect
@ -15,7 +15,7 @@ describe('search_mbyte', function()
Test bce:
]=])
wait()
poke_eventloop()
command('/^Test bce:/+1')
command([[$put =search('', 'bce', line('.'))]])

View File

@ -6,7 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local funcs = helpers.funcs
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('search cmdline', function()
local screen
@ -483,9 +483,9 @@ describe('search cmdline', function()
-- "interactive". This mimics Vim's test_override("char_avail").
-- (See legacy test: test_search.vim)
feed('?the')
wait()
poke_eventloop()
feed('<c-g>')
wait()
poke_eventloop()
feed('<cr>')
screen:expect([[
1 the first |
@ -496,11 +496,11 @@ describe('search cmdline', function()
command('$')
feed('?the')
wait()
poke_eventloop()
feed('<c-g>')
wait()
poke_eventloop()
feed('<c-g>')
wait()
poke_eventloop()
feed('<cr>')
screen:expect([[
1 ^the first |
@ -511,13 +511,13 @@ describe('search cmdline', function()
command('$')
feed('?the')
wait()
poke_eventloop()
feed('<c-g>')
wait()
poke_eventloop()
feed('<c-g>')
wait()
poke_eventloop()
feed('<c-g>')
wait()
poke_eventloop()
feed('<cr>')
screen:expect([[
1 the first |
@ -528,9 +528,9 @@ describe('search cmdline', function()
command('$')
feed('?the')
wait()
poke_eventloop()
feed('<c-t>')
wait()
poke_eventloop()
feed('<cr>')
screen:expect([[
1 ^the first |
@ -541,11 +541,11 @@ describe('search cmdline', function()
command('$')
feed('?the')
wait()
poke_eventloop()
feed('<c-t>')
wait()
poke_eventloop()
feed('<c-t>')
wait()
poke_eventloop()
feed('<cr>')
screen:expect([[
1 the first |
@ -556,13 +556,13 @@ describe('search cmdline', function()
command('$')
feed('?the')
wait()
poke_eventloop()
feed('<c-t>')
wait()
poke_eventloop()
feed('<c-t>')
wait()
poke_eventloop()
feed('<c-t>')
wait()
poke_eventloop()
feed('<cr>')
screen:expect([[
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 eq, eval = helpers.eq, helpers.eval
local source = helpers.source
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('utf8', function()
before_each(clear)
@ -18,7 +18,7 @@ describe('utf8', function()
-- Visual block Insert adjusts for multi-byte char
feed('gg0l<C-V>jjIx<Esc>')
wait()
poke_eventloop()
command('let r = getline(1, "$")')
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 clear, command = helpers.clear, helpers.command
local eq, eval = helpers.eq, helpers.eval
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('wordcount', function()
before_each(clear)
@ -14,7 +14,7 @@ describe('wordcount', function()
insert([=[
RESULT test:]=])
wait()
poke_eventloop()
command('new')
source([=[
@ -127,7 +127,7 @@ describe('wordcount', function()
-- -- Start visual mode quickly and select complete buffer.
command('0')
feed('V2jy<cr>')
wait()
poke_eventloop()
command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat')
@ -144,7 +144,7 @@ describe('wordcount', function()
-- Start visual mode quickly and select complete buffer.
command('0')
feed('v$y<cr>')
wait()
poke_eventloop()
command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat')
@ -161,7 +161,7 @@ describe('wordcount', function()
-- Start visual mode quickly and select complete buffer.
command('2')
feed('0v$y<cr>')
wait()
poke_eventloop()
command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat')

View File

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

View File

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

View File

@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
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 feed = helpers.feed
local feed_command, eval = helpers.feed_command, helpers.eval
@ -29,7 +29,7 @@ describe(':terminal', function()
-- Invoke a command that emits frequent terminal activity.
feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 9999 !terminal_output!<cr>]])
feed([[<C-\><C-N>]])
wait()
poke_eventloop()
-- Wait for some terminal activity.
retry(nil, 4000, function()
ok(funcs.line('$') > 6)
@ -60,7 +60,7 @@ describe(':terminal', function()
feed_command([[terminal while true; do echo foo; sleep .1; done]])
end
feed([[<C-\><C-N>M]]) -- move cursor away from last line
wait()
poke_eventloop()
eq(3, eval("line('$')")) -- window height
eq(2, eval("line('.')")) -- cursor is in the middle
feed_command('vsplit')
@ -76,11 +76,11 @@ describe(':terminal', function()
-- Create a new line (in the shell). For a normal buffer this
-- increments the jumplist; for a terminal-buffer it should not. #3723
feed('i')
wait()
poke_eventloop()
feed('<CR><CR><CR><CR>')
wait()
poke_eventloop()
feed([[<C-\><C-N>]])
wait()
poke_eventloop()
-- Wait for >=1 lines to be created.
retry(nil, 4000, function()
ok(funcs.line('$') > lines_before)
@ -210,7 +210,7 @@ describe(':terminal (with fake shell)', function()
it('ignores writes if the backing stream closes', function()
terminal_with_fake_shell()
feed('iiXXXXXXX')
wait()
poke_eventloop()
-- Race: Though the shell exited (and streams were closed by SIGCHLD
-- handler), :terminal cleanup is pending on the main-loop.
-- 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 eval = helpers.eval
local command = helpers.command
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local retry = helpers.retry
local curbufmeths = helpers.curbufmeths
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)
screen:attach({rgb=false})
feed_command('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert')
wait()
poke_eventloop()
screen:expect([[
line6 |
line7 |
@ -423,7 +423,7 @@ describe("'scrollback' option", function()
retry(nil, nil, function() expect_lines(33, 2) end)
curbufmeths.set_option('scrollback', 10)
wait()
poke_eventloop()
retry(nil, nil, function() expect_lines(16) end)
curbufmeths.set_option('scrollback', 10000)
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 feed_data = thelpers.feed_data
local feed, clear = helpers.feed, helpers.clear
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
local iswin = helpers.iswin
local command = helpers.command
local retry = helpers.retry
@ -127,7 +127,7 @@ describe(':terminal window', function()
it('wont show any folds', function()
feed([[<C-\><C-N>ggvGzf]])
wait()
poke_eventloop()
screen:expect([[
^tty ready |
line1 |

View File

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

View File

@ -546,7 +546,7 @@ describe('ui/mouse/input', function()
:tabprevious |
]])
feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab
helpers.wait()
helpers.poke_eventloop()
feed('<LeftMouse><0,1>')
screen:expect([[
{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 eq = helpers.eq
local meths = helpers.meths
local wait = helpers.wait
local poke_eventloop = helpers.poke_eventloop
describe('ext_multigrid', function()
@ -1846,8 +1846,8 @@ describe('ext_multigrid', function()
meths.input_mouse('left', 'press', '', 1,6, 20)
-- TODO(bfredl): "batching" input_mouse is formally not supported yet.
-- Normally it should work fine in async context when nvim is not blocked,
-- but add a wait be sure.
wait()
-- but add a poke_eventloop be sure.
poke_eventloop()
meths.input_mouse('left', 'drag', '', 1, 4, 20)
screen:expect{grid=[[
## grid 1
@ -1921,7 +1921,7 @@ describe('ext_multigrid', function()
]]}
meths.input_mouse('left', 'press', '', 1,8, 26)
wait()
poke_eventloop()
meths.input_mouse('left', 'drag', '', 1, 6, 30)
screen:expect{grid=[[
## grid 1

View File

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

View File

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