diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/keymap_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 37 | ||||
-rw-r--r-- | test/functional/autocmd/tabclose_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/autocmd/tabnewentered_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/ex_cmds/script_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ex_cmds/sign_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/helpers.lua | 2 | ||||
-rw-r--r-- | test/functional/lua/overrides_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/options/keymap_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/ui/cmdline_highlight_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 4 |
13 files changed, 53 insertions, 53 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index 773207d360..210394c83f 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -585,13 +585,13 @@ describe('nvim_set_keymap, nvim_del_keymap', function() end) it('can set <expr> mappings whose RHS change dynamically', function() - meths.command_output([[ + meths.exec([[ function! FlipFlop() abort if !exists('g:flip') | let g:flip = 0 | endif let g:flip = !g:flip return g:flip endfunction - ]]) + ]], true) eq(1, meths.call_function('FlipFlop', {})) eq(0, meths.call_function('FlipFlop', {})) eq(1, meths.call_function('FlipFlop', {})) diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index d7baf68a5b..d901a5e2eb 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -84,7 +84,7 @@ describe('API', function() it(':verbose set {option}?', function() nvim('exec', 'set nowrap', false) - eq('nowrap\n\tLast set from :source (no file)', + eq('nowrap\n\tLast set from anonymous :source', nvim('exec', 'verbose set wrap?', true)) end) @@ -433,41 +433,44 @@ describe('API', function() end) end) - describe('nvim_execute_lua', function() + describe('nvim_exec_lua', function() it('works', function() - meths.execute_lua('vim.api.nvim_set_var("test", 3)', {}) + meths.exec_lua('vim.api.nvim_set_var("test", 3)', {}) eq(3, meths.get_var('test')) - eq(17, meths.execute_lua('a, b = ...\nreturn a + b', {10,7})) + eq(17, meths.exec_lua('a, b = ...\nreturn a + b', {10,7})) - eq(NIL, meths.execute_lua('function xx(a,b)\nreturn a..b\nend',{})) + eq(NIL, meths.exec_lua('function xx(a,b)\nreturn a..b\nend',{})) + eq("xy", meths.exec_lua('return xx(...)', {'x','y'})) + + -- Deprecated name: nvim_execute_lua. eq("xy", meths.execute_lua('return xx(...)', {'x','y'})) end) it('reports errors', function() eq([[Error loading lua: [string "<nvim>"]:1: '=' expected near '+']], - pcall_err(meths.execute_lua, 'a+*b', {})) + pcall_err(meths.exec_lua, 'a+*b', {})) eq([[Error loading lua: [string "<nvim>"]:1: unexpected symbol near '1']], - pcall_err(meths.execute_lua, '1+2', {})) + pcall_err(meths.exec_lua, '1+2', {})) eq([[Error loading lua: [string "<nvim>"]:1: unexpected symbol]], - pcall_err(meths.execute_lua, 'aa=bb\0', {})) + pcall_err(meths.exec_lua, 'aa=bb\0', {})) eq([[Error executing lua: [string "<nvim>"]:1: attempt to call global 'bork' (a nil value)]], - pcall_err(meths.execute_lua, 'bork()', {})) + pcall_err(meths.exec_lua, 'bork()', {})) eq('Error executing lua: [string "<nvim>"]:1: did\nthe\nfail', - pcall_err(meths.execute_lua, 'error("did\\nthe\\nfail")', {})) + pcall_err(meths.exec_lua, 'error("did\\nthe\\nfail")', {})) end) it('uses native float values', function() - eq(2.5, meths.execute_lua("return select(1, ...)", {2.5})) - eq("2.5", meths.execute_lua("return vim.inspect(...)", {2.5})) + eq(2.5, meths.exec_lua("return select(1, ...)", {2.5})) + eq("2.5", meths.exec_lua("return vim.inspect(...)", {2.5})) -- "special" float values are still accepted as return values. - eq(2.5, meths.execute_lua("return vim.api.nvim_eval('2.5')", {})) - eq("{\n [false] = 2.5,\n [true] = 3\n}", meths.execute_lua("return vim.inspect(vim.api.nvim_eval('2.5'))", {})) + eq(2.5, meths.exec_lua("return vim.api.nvim_eval('2.5')", {})) + eq("{\n [false] = 2.5,\n [true] = 3\n}", meths.exec_lua("return vim.inspect(vim.api.nvim_eval('2.5'))", {})) end) end) @@ -573,7 +576,7 @@ describe('API', function() eq({0,3,14,0}, funcs.getpos('.')) end) it('vim.paste() failure', function() - nvim('execute_lua', 'vim.paste = (function(lines, phase) error("fake fail") end)', {}) + nvim('exec_lua', 'vim.paste = (function(lines, phase) error("fake fail") end)', {}) eq([[Error executing lua: [string "<nvim>"]:1: fake fail]], pcall_err(request, 'nvim_paste', 'line 1\nline 2\nline 3', false, 1)) end) @@ -797,7 +800,7 @@ describe('API', function() ok(nil ~= string.find(rv, 'noequalalways\n'.. '\tLast set from API client %(channel id %d+%)')) - nvim('execute_lua', 'vim.api.nvim_set_option("equalalways", true)', {}) + nvim('exec_lua', 'vim.api.nvim_set_option("equalalways", true)', {}) status, rv = pcall(nvim, 'command_output', 'verbose set equalalways?') eq(true, status) @@ -1800,7 +1803,7 @@ describe('API', function() eq(' 1 %a "[No Name]" line 1\n'.. ' 3 h "[Scratch]" line 0\n'.. ' 4 h "[Scratch]" line 0', - meths.command_output("ls")) + meths.exec('ls', true)) -- current buffer didn't change eq({id=1}, meths.get_current_buf()) diff --git a/test/functional/autocmd/tabclose_spec.lua b/test/functional/autocmd/tabclose_spec.lua index b7c33dc3d8..92d860c628 100644 --- a/test/functional/autocmd/tabclose_spec.lua +++ b/test/functional/autocmd/tabclose_spec.lua @@ -11,10 +11,10 @@ describe('TabClosed', function() repeat nvim('command', 'tabnew') until nvim('eval', 'tabpagenr()') == 6 -- current tab is now 6 - eq("tabclosed:6:6:5", nvim('command_output', 'tabclose')) -- close last 6, current tab is now 5 - eq("tabclosed:5:5:4", nvim('command_output', 'close')) -- close last window on tab, closes tab - eq("tabclosed:2:2:3", nvim('command_output', '2tabclose')) -- close tab 2, current tab is now 3 - eq("tabclosed:1:1:2\ntabclosed:1:1:1", nvim('command_output', 'tabonly')) -- close tabs 1 and 2 + eq("tabclosed:6:6:5", nvim('exec', 'tabclose', true)) -- close last 6, current tab is now 5 + eq("tabclosed:5:5:4", nvim('exec', 'close', true)) -- close last window on tab, closes tab + eq("tabclosed:2:2:3", nvim('exec', '2tabclose', true)) -- close tab 2, current tab is now 3 + eq("tabclosed:1:1:2\ntabclosed:1:1:1", nvim('exec', 'tabonly', true)) -- close tabs 1 and 2 end) it('is triggered when closing a window via bdelete from another tab', function() @@ -23,7 +23,7 @@ describe('TabClosed', function() nvim('command', '1tabedit Xtestfile') nvim('command', 'normal! 1gt') eq({1, 3}, nvim('eval', '[tabpagenr(), tabpagenr("$")]')) - eq("tabclosed:2:2:1\ntabclosed:2:2:1", nvim('command_output', 'bdelete Xtestfile')) + eq("tabclosed:2:2:1\ntabclosed:2:2:1", nvim('exec', 'bdelete Xtestfile', true)) eq({1, 1}, nvim('eval', '[tabpagenr(), tabpagenr("$")]')) end) @@ -35,7 +35,7 @@ describe('TabClosed', function() -- Only one tab is closed, and the alternate file is used for the other. eq({2, 3}, nvim('eval', '[tabpagenr(), tabpagenr("$")]')) - eq("tabclosed:2:2:2", nvim('command_output', 'bdelete Xtestfile2')) + eq("tabclosed:2:2:2", nvim('exec', 'bdelete Xtestfile2', true)) eq('Xtestfile1', nvim('eval', 'bufname("")')) end) end) @@ -48,9 +48,9 @@ describe('TabClosed', function() nvim('command', 'tabnew') until nvim('eval', 'tabpagenr()') == 7 -- current tab is now 7 -- sanity check, we shouldn't match on tabs with numbers other than 2 - eq("tabclosed:7:7:6", nvim('command_output', 'tabclose')) + eq("tabclosed:7:7:6", nvim('exec', 'tabclose', true)) -- close tab page 2, current tab is now 5 - eq("tabclosed:2:2:5\ntabclosed:match", nvim('command_output', '2tabclose')) + eq("tabclosed:2:2:5\ntabclosed:match", nvim('exec', '2tabclose', true)) end) end) @@ -59,7 +59,7 @@ describe('TabClosed', function() nvim('command', 'au! TabClosed * echom "tabclosed:".expand("<afile>").":".expand("<amatch>").":".tabpagenr()') nvim('command', 'tabedit Xtestfile') eq({2, 2}, nvim('eval', '[tabpagenr(), tabpagenr("$")]')) - eq("tabclosed:2:2:1", nvim('command_output', 'close')) + eq("tabclosed:2:2:1", nvim('exec', 'close', true)) eq({1, 1}, nvim('eval', '[tabpagenr(), tabpagenr("$")]')) end) end) diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua index 59cac07b34..32e341184d 100644 --- a/test/functional/autocmd/tabnewentered_spec.lua +++ b/test/functional/autocmd/tabnewentered_spec.lua @@ -7,15 +7,15 @@ describe('TabNewEntered', function() it('matches when entering any new tab', function() clear() nvim('command', 'au! TabNewEntered * echom "tabnewentered:".tabpagenr().":".bufnr("")') - eq("tabnewentered:2:2", nvim('command_output', 'tabnew')) - eq("tabnewentered:3:3", nvim('command_output', 'tabnew test.x2')) + eq("tabnewentered:2:2", nvim('exec', 'tabnew', true)) + eq("tabnewentered:3:3", nvim('exec', 'tabnew test.x2', true)) end) end) describe('with FILE as <afile>', function() it('matches when opening a new tab for FILE', function() nvim('command', 'au! TabNewEntered Xtest-tabnewentered echom "tabnewentered:match"') eq('tabnewentered:4:4\ntabnewentered:match', - nvim('command_output', 'tabnew Xtest-tabnewentered')) + nvim('exec', 'tabnew Xtest-tabnewentered', true)) end) end) describe('with CTRL-W T', function() @@ -24,7 +24,7 @@ describe('TabNewEntered', function() nvim('command', 'au! TabNewEntered * echom "entered"') nvim('command', 'tabnew test.x2') nvim('command', 'split') - eq('entered', nvim('command_output', 'execute "normal \\<C-W>T"')) + eq('entered', nvim('exec', 'execute "normal \\<C-W>T"', true)) end) end) end) diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua index 4e57d2755d..0a772c559b 100644 --- a/test/functional/ex_cmds/script_spec.lua +++ b/test/functional/ex_cmds/script_spec.lua @@ -22,7 +22,7 @@ describe('script_get-based command', function() %s %s endif ]])):format(cmd, garbage))) - eq('', meths.command_output('messages')) + eq('', meths.exec('messages', true)) if check_neq then neq(0, exc_exec(dedent([[ %s %s @@ -37,7 +37,7 @@ describe('script_get-based command', function() EOF endif ]])):format(cmd, garbage))) - eq('', meths.command_output('messages')) + eq('', meths.exec('messages', true)) if check_neq then eq(true, pcall(source, (dedent([[ let g:exc = 0 diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua index 9d08a66625..891cfe1670 100644 --- a/test/functional/ex_cmds/sign_spec.lua +++ b/test/functional/ex_cmds/sign_spec.lua @@ -16,8 +16,8 @@ describe('sign', function() nvim('command', 'sign place 34 line=3 name=Foo buffer='..buf2) -- now unplace without specifying a buffer nvim('command', 'sign unplace 34') - eq("--- Signs ---\n", nvim('command_output', 'sign place buffer='..buf1)) - eq("--- Signs ---\n", nvim('command_output', 'sign place buffer='..buf2)) + eq("--- Signs ---\n", nvim('exec', 'sign place buffer='..buf1, true)) + eq("--- Signs ---\n", nvim('exec', 'sign place buffer='..buf2, true)) end) end) end) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 1108fbb2ba..0f2b04ea00 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -706,7 +706,7 @@ module.curwinmeths = module.create_callindex(module.curwin) module.curtabmeths = module.create_callindex(module.curtab) function module.exec_lua(code, ...) - return module.meths.execute_lua(code, {...}) + return module.meths.exec_lua(code, {...}) end function module.redir_exec(cmd) diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index 8c260632d9..1bccc02847 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -299,14 +299,11 @@ describe('package.path/package.cpath', function() end return new_paths end - local function execute_lua(cmd, ...) - return meths.execute_lua(cmd, {...}) - end local function eval_lua(expr, ...) - return meths.execute_lua('return ' .. expr, {...}) + return meths.exec_lua('return '..expr, {...}) end local function set_path(which, value) - return execute_lua('package[select(1, ...)] = select(2, ...)', which, value) + return exec_lua('package[select(1, ...)] = select(2, ...)', which, value) end it('contains directories from &runtimepath on first invocation', function() diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua index 7f6d623dc7..52a714f7a8 100644 --- a/test/functional/options/keymap_spec.lua +++ b/test/functional/options/keymap_spec.lua @@ -30,7 +30,7 @@ describe("'keymap' / :lmap", function() command('lmapclear <buffer>') command('set keymap=dvorak') command('set nomore') - local bindings = funcs.nvim_command_output('lmap') + local bindings = funcs.nvim_exec('lmap', true) eq(dedent([[ l " @_ diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 2fc7a021cb..d40baca871 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -60,7 +60,7 @@ describe(':terminal buffer', function() end) it('does not create swap files', function() - local swapfile = nvim('command_output', 'swapname'):gsub('\n', '') + local swapfile = nvim('exec', 'swapname', true):gsub('\n', '') eq(nil, io.open(swapfile)) end) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 676d6ef76d..077e9dc7d5 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -486,7 +486,7 @@ describe('TUI', function() end) it('paste: recovers from vim.paste() failure', function() - child_session:request('nvim_execute_lua', [[ + child_session:request('nvim_exec_lua', [[ _G.save_paste_fn = vim.paste vim.paste = function(lines, phase) error("fake fail") end ]], {}) @@ -544,7 +544,7 @@ describe('TUI', function() {3:-- TERMINAL --} | ]]} -- Paste works if vim.paste() succeeds. - child_session:request('nvim_execute_lua', [[ + child_session:request('nvim_exec_lua', [[ vim.paste = _G.save_paste_fn ]], {}) feed_data('\027[200~line A\nline B\n\027[201~') @@ -563,7 +563,7 @@ describe('TUI', function() it('paste: vim.paste() cancel (retval=false) #10865', function() -- This test only exercises the "cancel" case. Use-case would be "dangling -- paste", but that is not implemented yet. #10865 - child_session:request('nvim_execute_lua', [[ + child_session:request('nvim_exec_lua', [[ vim.paste = function(lines, phase) return false end ]], {}) feed_data('\027[200~line A\nline B\n\027[201~') diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 052414a43d..9c746b99bd 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -362,7 +362,7 @@ describe('Command-line coloring', function() {EOB:~ }| :e^ | ]]) - eq('', meths.command_output('messages')) + eq('', meths.exec('messages', true)) end) it('silences :echon', function() set_color_cb('Echoning') @@ -377,7 +377,7 @@ describe('Command-line coloring', function() {EOB:~ }| :e^ | ]]) - eq('', meths.command_output('messages')) + eq('', meths.exec('messages', true)) end) it('silences :echomsg', function() set_color_cb('Echomsging') @@ -392,7 +392,7 @@ describe('Command-line coloring', function() {EOB:~ }| :e^ | ]]) - eq('', meths.command_output('messages')) + eq('', meths.exec('messages', true)) end) it('does the right thing when throwing', function() set_color_cb('Throwing') @@ -857,7 +857,7 @@ describe('Ex commands coloring', function() ]]) feed('<CR>') eq('Error detected while processing :\nE605: Exception not caught: 42\nE749: empty buffer', - meths.command_output('messages')) + meths.exec('messages', true)) end) it('errors out when failing to get callback', function() meths.set_var('Nvim_color_cmdline', 42) diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 40ea030f73..25b38b1feb 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -861,7 +861,7 @@ describe('ui/builtin messages', function() -- screen size doesn't affect internal output #10285 eq('ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red', - meths.command_output("hi ErrorMsg")) + meths.exec("hi ErrorMsg", true)) end) it(':syntax list langGroup output', function() @@ -900,7 +900,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim match /\<endif\s\+".*$/ms=s+5,lc=5 contains=@vimCommentGroup,vimCommentString match /\<else\s\+".*$/ms=s+4,lc=4 contains=@vimCommentGroup,vimCommentString links to Comment]], - meths.command_output('syntax list vimComment')) + meths.exec('syntax list vimComment', true)) -- luacheck: pop end) |