diff options
Diffstat (limited to 'test/functional/vimscript')
19 files changed, 124 insertions, 124 deletions
diff --git a/test/functional/vimscript/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua index 05876c43d1..6249dcc363 100644 --- a/test/functional/vimscript/api_functions_spec.lua +++ b/test/functional/vimscript/api_functions_spec.lua @@ -80,20 +80,20 @@ describe('eval-API', function() -- Text-changing functions gave a "Failed to save undo information" error when called from an -- <expr> mapping outside do_cmdline() (msg_list == NULL), so use feed() to test this. command("inoremap <expr> <f2> nvim_buf_set_text(0, 0, 0, 0, 0, ['hi'])") - meths.set_vvar('errmsg', '') + meths.nvim_set_vvar('errmsg', '') feed('i<f2><esc>') eq( 'E5555: API call: E565: Not allowed to change text or change window', - meths.get_vvar('errmsg') + meths.nvim_get_vvar('errmsg') ) -- Some functions checking textlock (usually those that may change the current window or buffer) -- also ought to not be usable in the cmdwin. - local old_win = meths.get_current_win() + local old_win = meths.nvim_get_current_win() feed('q:') eq( 'E11: Invalid in command-line window; <CR> executes, CTRL-C quits', - pcall_err(meths.set_current_win, old_win) + pcall_err(meths.nvim_set_current_win, old_win) ) -- But others, like nvim_buf_set_lines(), which just changes text, is OK. @@ -103,13 +103,13 @@ describe('eval-API', function() -- Turning the cmdwin buffer into a terminal buffer would be pretty weird. eq( 'E11: Invalid in command-line window; <CR> executes, CTRL-C quits', - pcall_err(meths.open_term, 0, {}) + pcall_err(meths.nvim_open_term, 0, {}) ) -- But turning a different buffer into a terminal from the cmdwin is OK. - local term_buf = meths.create_buf(false, true) - meths.open_term(term_buf, {}) - eq('terminal', meths.get_option_value('buftype', { buf = term_buf })) + local term_buf = meths.nvim_create_buf(false, true) + meths.nvim_open_term(term_buf, {}) + eq('terminal', meths.nvim_get_option_value('buftype', { buf = term_buf })) end) it('use buffer numbers and windows ids as handles', function() @@ -207,7 +207,7 @@ describe('eval-API', function() 'Vim(call):E48: Not allowed in sandbox', pcall_err(command, "sandbox call nvim_input('ievil')") ) - eq({ '' }, meths.buf_get_lines(0, 0, -1, true)) + eq({ '' }, meths.nvim_buf_get_lines(0, 0, -1, true)) end) it('converts blobs to API strings', function() diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index 1b722247a8..c93e55df5f 100644 --- a/test/functional/vimscript/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua @@ -90,12 +90,12 @@ describe('bufname() function', function() local curdirname = funcs.fnamemodify(wd, ':t') for _, arg in ipairs({ '%', 1, 'X', wd }) do eq(fname, funcs.bufname(arg)) - meths.set_current_dir('..') + meths.nvim_set_current_dir('..') eq(curdirname .. sep .. fname, funcs.bufname(arg)) - meths.set_current_dir(curdirname) - meths.set_current_dir(dirname) + meths.nvim_set_current_dir(curdirname) + meths.nvim_set_current_dir(dirname) eq(wd .. sep .. fname, funcs.bufname(arg)) - meths.set_current_dir('..') + meths.nvim_set_current_dir('..') eq(fname, funcs.bufname(arg)) command('enew') end @@ -172,7 +172,7 @@ describe('bufwinnr() function', function() eq(2, funcs.bufwinnr(fname)) eq(1, funcs.bufwinnr(fname2)) eq(-1, funcs.bufwinnr(fname:sub(1, #fname - 1))) - meths.set_current_dir(dirname) + meths.nvim_set_current_dir(dirname) eq(2, funcs.bufwinnr(fname)) eq(1, funcs.bufwinnr(fname2)) eq(-1, funcs.bufwinnr(fname:sub(1, #fname - 1))) @@ -203,7 +203,7 @@ describe('getbufline() function', function() eq({}, funcs.getbufline(1, -1, 9999)) end) it('returns expected lines', function() - meths.set_option_value('hidden', true, {}) + meths.nvim_set_option_value('hidden', true, {}) command('file ' .. fname) curbufmeths.set_lines(0, 1, false, { 'foo\0', '\0bar', 'baz' }) command('edit ' .. fname2) @@ -284,29 +284,29 @@ describe('setbufvar() function', function() ) end) it('may set options, including window-local and global values', function() - local buf1 = meths.get_current_buf() - eq(false, meths.get_option_value('number', {})) + local buf1 = meths.nvim_get_current_buf() + eq(false, meths.nvim_get_option_value('number', {})) command('split') command('new') eq(2, bufmeths.get_number(curwinmeths.get_buf())) funcs.setbufvar(1, '&number', true) local windows = curtabmeths.list_wins() - eq(false, meths.get_option_value('number', { win = windows[1].id })) - eq(true, meths.get_option_value('number', { win = windows[2].id })) - eq(false, meths.get_option_value('number', { win = windows[3].id })) - eq(false, meths.get_option_value('number', { win = meths.get_current_win().id })) + eq(false, meths.nvim_get_option_value('number', { win = windows[1].id })) + eq(true, meths.nvim_get_option_value('number', { win = windows[2].id })) + eq(false, meths.nvim_get_option_value('number', { win = windows[3].id })) + eq(false, meths.nvim_get_option_value('number', { win = meths.nvim_get_current_win().id })) - eq(true, meths.get_option_value('hidden', {})) + eq(true, meths.nvim_get_option_value('hidden', {})) funcs.setbufvar(1, '&hidden', 0) - eq(false, meths.get_option_value('hidden', {})) + eq(false, meths.nvim_get_option_value('hidden', {})) - eq(false, meths.get_option_value('autoindent', { buf = buf1.id })) + eq(false, meths.nvim_get_option_value('autoindent', { buf = buf1.id })) funcs.setbufvar(1, '&autoindent', true) - eq(true, meths.get_option_value('autoindent', { buf = buf1.id })) + eq(true, meths.nvim_get_option_value('autoindent', { buf = buf1.id })) eq('Vim(call):E355: Unknown option: xxx', exc_exec('call setbufvar(1, "&xxx", 0)')) end) it('may set variables', function() - local buf1 = meths.get_current_buf() + local buf1 = meths.nvim_get_current_buf() command('split') command('new') eq(2, curbufmeths.get_number()) diff --git a/test/functional/vimscript/changedtick_spec.lua b/test/functional/vimscript/changedtick_spec.lua index 1ff580e570..04ebc9cdc9 100644 --- a/test/functional/vimscript/changedtick_spec.lua +++ b/test/functional/vimscript/changedtick_spec.lua @@ -41,7 +41,7 @@ describe('b:changedtick', function() it('is present in b: dictionary', function() eq(2, changedtick()) command('let d = b:') - eq(2, meths.get_var('d').changedtick) + eq(2, meths.nvim_get_var('d').changedtick) end) it('increments at bdel', function() command('new') @@ -142,7 +142,7 @@ describe('b:changedtick', function() end) it('is being completed', function() feed(':echo b:<Tab><Home>let cmdline="<End>"<CR>') - eq('echo b:changedtick', meths.get_var('cmdline')) + eq('echo b:changedtick', meths.nvim_get_var('cmdline')) end) it('cannot be changed by filter() or map()', function() eq(2, changedtick()) diff --git a/test/functional/vimscript/container_functions_spec.lua b/test/functional/vimscript/container_functions_spec.lua index cb5644cf2d..62e6efd7c2 100644 --- a/test/functional/vimscript/container_functions_spec.lua +++ b/test/functional/vimscript/container_functions_spec.lua @@ -9,16 +9,16 @@ before_each(clear) describe('extend()', function() it('succeeds to extend list with itself', function() - meths.set_var('l', { 1, {} }) + meths.nvim_set_var('l', { 1, {} }) eq({ 1, {}, 1, {} }, eval('extend(l, l)')) - eq({ 1, {}, 1, {} }, meths.get_var('l')) + eq({ 1, {}, 1, {} }, meths.nvim_get_var('l')) - meths.set_var('l', { 1, {} }) + meths.nvim_set_var('l', { 1, {} }) eq({ 1, {}, 1, {} }, eval('extend(l, l, 0)')) - eq({ 1, {}, 1, {} }, meths.get_var('l')) + eq({ 1, {}, 1, {} }, meths.nvim_get_var('l')) - meths.set_var('l', { 1, {} }) + meths.nvim_set_var('l', { 1, {} }) eq({ 1, 1, {}, {} }, eval('extend(l, l, 1)')) - eq({ 1, 1, {}, {} }, meths.get_var('l')) + eq({ 1, 1, {}, {} }, meths.nvim_get_var('l')) end) end) diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua index da8be7e90c..180e6118fd 100644 --- a/test/functional/vimscript/eval_spec.lua +++ b/test/functional/vimscript/eval_spec.lua @@ -121,7 +121,7 @@ describe('List support code', function() let bl = range(%u) let dur = reltimestr(reltime(rt)) ]]):format(len)) - dur = tonumber(meths.get_var('dur')) + dur = tonumber(meths.nvim_get_var('dur')) if dur >= min_dur then -- print(('Using len %u, dur %g'):format(len, dur)) break @@ -136,7 +136,7 @@ describe('List support code', function() feed('<C-c>') poke_eventloop() command('let t_dur = reltimestr(reltime(t_rt))') - local t_dur = tonumber(meths.get_var('t_dur')) + local t_dur = tonumber(meths.nvim_get_var('t_dur')) if t_dur >= dur / 8 then eq(nil, ('Took too long to cancel: %g >= %g'):format(t_dur, dur / 8)) end @@ -147,7 +147,7 @@ describe('List support code', function() feed('<C-c>') poke_eventloop() command('let t_dur = reltimestr(reltime(t_rt))') - local t_dur = tonumber(meths.get_var('t_dur')) + local t_dur = tonumber(meths.nvim_get_var('t_dur')) print(('t_dur: %g'):format(t_dur)) if t_dur >= dur / 8 then eq(nil, ('Took too long to cancel: %g >= %g'):format(t_dur, dur / 8)) diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua index 52c28869ff..2e1d0501cf 100644 --- a/test/functional/vimscript/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua @@ -110,7 +110,7 @@ describe('input()', function() end) it('allows unequal numeric values when using {opts} dictionary', function() command('echohl Test') - meths.set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 }) + meths.nvim_set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 }) feed([[:echo input(opts)<CR>]]) screen:expect([[ | @@ -132,7 +132,7 @@ describe('input()', function() end) it('works with redraw', function() command('echohl Test') - meths.set_var('opts', { prompt = 'Foo>', default = 'Bar' }) + meths.nvim_set_var('opts', { prompt = 'Foo>', default = 'Bar' }) feed([[:echo inputdialog(opts)<CR>]]) screen:expect([[ | @@ -176,34 +176,34 @@ describe('input()', function() it('supports completion', function() feed(':let var = input("", "", "custom,CustomCompl")<CR>') feed('<Tab><CR>') - eq('TEST', meths.get_var('var')) + eq('TEST', meths.nvim_get_var('var')) feed(':let var = input({"completion": "customlist,CustomListCompl"})<CR>') feed('<Tab><CR>') - eq('FOO', meths.get_var('var')) + eq('FOO', meths.nvim_get_var('var')) end) it('supports cancelreturn', function() feed(':let var = input({"cancelreturn": "BAR"})<CR>') feed('<Esc>') - eq('BAR', meths.get_var('var')) + eq('BAR', meths.nvim_get_var('var')) feed(':let var = input({"cancelreturn": []})<CR>') feed('<Esc>') - eq({}, meths.get_var('var')) + eq({}, meths.nvim_get_var('var')) feed(':let var = input({"cancelreturn": v:false})<CR>') feed('<Esc>') - eq(false, meths.get_var('var')) + eq(false, meths.nvim_get_var('var')) feed(':let var = input({"cancelreturn": v:null})<CR>') feed('<Esc>') - eq(NIL, meths.get_var('var')) + eq(NIL, meths.nvim_get_var('var')) end) it('supports default string', function() feed(':let var = input("", "DEF1")<CR>') feed('<CR>') - eq('DEF1', meths.get_var('var')) + eq('DEF1', meths.nvim_get_var('var')) feed(':let var = input({"default": "DEF2"})<CR>') feed('<CR>') - eq('DEF2', meths.get_var('var')) + eq('DEF2', meths.nvim_get_var('var')) end) it('errors out on invalid inputs', function() eq('Vim(call):E730: Using a List as a String', exc_exec('call input([])')) @@ -292,7 +292,7 @@ describe('inputdialog()', function() end) it('allows unequal numeric values when using {opts} dictionary', function() command('echohl Test') - meths.set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 }) + meths.nvim_set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 }) feed([[:echo input(opts)<CR>]]) screen:expect([[ | @@ -314,7 +314,7 @@ describe('inputdialog()', function() end) it('works with redraw', function() command('echohl Test') - meths.set_var('opts', { prompt = 'Foo>', default = 'Bar' }) + meths.nvim_set_var('opts', { prompt = 'Foo>', default = 'Bar' }) feed([[:echo input(opts)<CR>]]) screen:expect([[ | @@ -358,25 +358,25 @@ describe('inputdialog()', function() it('supports completion', function() feed(':let var = inputdialog({"completion": "customlist,CustomListCompl"})<CR>') feed('<Tab><CR>') - eq('FOO', meths.get_var('var')) + eq('FOO', meths.nvim_get_var('var')) end) it('supports cancelreturn', function() feed(':let var = inputdialog("", "", "CR1")<CR>') feed('<Esc>') - eq('CR1', meths.get_var('var')) + eq('CR1', meths.nvim_get_var('var')) feed(':let var = inputdialog({"cancelreturn": "BAR"})<CR>') feed('<Esc>') - eq('BAR', meths.get_var('var')) + eq('BAR', meths.nvim_get_var('var')) end) it('supports default string', function() feed(':let var = inputdialog("", "DEF1")<CR>') feed('<CR>') - eq('DEF1', meths.get_var('var')) + eq('DEF1', meths.nvim_get_var('var')) feed(':let var = inputdialog({"default": "DEF2"})<CR>') feed('<CR>') - eq('DEF2', meths.get_var('var')) + eq('DEF2', meths.nvim_get_var('var')) end) it('errors out on invalid inputs', function() eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog([])')) @@ -409,8 +409,8 @@ end) describe('confirm()', function() -- oldtest: Test_confirm() it('works', function() - meths.set_option_value('more', false, {}) -- Avoid hit-enter prompt - meths.set_option_value('laststatus', 2, {}) + meths.nvim_set_option_value('more', false, {}) -- Avoid hit-enter prompt + meths.nvim_set_option_value('laststatus', 2, {}) -- screen:expect() calls are needed to avoid feeding input too early screen:expect({ any = '%[No Name%]' }) @@ -418,19 +418,19 @@ describe('confirm()', function() screen:expect({ any = '{CONFIRM:.+: }' }) feed('o') screen:expect({ any = '%[No Name%]' }) - eq(1, meths.get_var('a')) + eq(1, meths.nvim_get_var('a')) async_meths.command([[let a = 'Are you sure?'->confirm("&Yes\n&No")]]) screen:expect({ any = '{CONFIRM:.+: }' }) feed('y') screen:expect({ any = '%[No Name%]' }) - eq(1, meths.get_var('a')) + eq(1, meths.nvim_get_var('a')) async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No")]]) screen:expect({ any = '{CONFIRM:.+: }' }) feed('n') screen:expect({ any = '%[No Name%]' }) - eq(2, meths.get_var('a')) + eq(2, meths.nvim_get_var('a')) -- Not possible to match Vim's CTRL-C test here as CTRL-C always sets got_int in Nvim. @@ -439,26 +439,26 @@ describe('confirm()', function() screen:expect({ any = '{CONFIRM:.+: }' }) feed('<Esc>') screen:expect({ any = '%[No Name%]' }) - eq(0, meths.get_var('a')) + eq(0, meths.nvim_get_var('a')) -- Default choice is returned when pressing <CR>. async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No")]]) screen:expect({ any = '{CONFIRM:.+: }' }) feed('<CR>') screen:expect({ any = '%[No Name%]' }) - eq(1, meths.get_var('a')) + eq(1, meths.nvim_get_var('a')) async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No", 2)]]) screen:expect({ any = '{CONFIRM:.+: }' }) feed('<CR>') screen:expect({ any = '%[No Name%]' }) - eq(2, meths.get_var('a')) + eq(2, meths.nvim_get_var('a')) async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No", 0)]]) screen:expect({ any = '{CONFIRM:.+: }' }) feed('<CR>') screen:expect({ any = '%[No Name%]' }) - eq(0, meths.get_var('a')) + eq(0, meths.nvim_get_var('a')) -- Test with the {type} 4th argument for _, type in ipairs({ 'Error', 'Question', 'Info', 'Warning', 'Generic' }) do @@ -466,7 +466,7 @@ describe('confirm()', function() screen:expect({ any = '{CONFIRM:.+: }' }) feed('y') screen:expect({ any = '%[No Name%]' }) - eq(1, meths.get_var('a')) + eq(1, meths.nvim_get_var('a')) end eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call confirm([])')) diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua index e469b45b34..8f54cce444 100644 --- a/test/functional/vimscript/json_functions_spec.lua +++ b/test/functional/vimscript/json_functions_spec.lua @@ -494,7 +494,7 @@ describe('json_decode() function', function() end) local sp_decode_eq = function(expected, json) - meths.set_var('__json', json) + meths.nvim_set_var('__json', json) speq(expected, 'json_decode(g:__json)') command('unlet! g:__json') end @@ -892,7 +892,7 @@ describe('json_encode() function', function() end) it('ignores improper values in &isprint', function() - meths.set_option_value('isprint', '1', {}) + meths.nvim_set_option_value('isprint', '1', {}) eq(1, eval('"\1" =~# "\\\\p"')) eq('"\\u0001"', funcs.json_encode('\1')) end) diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua index 6cb52badb6..7c632fc67e 100644 --- a/test/functional/vimscript/let_spec.lua +++ b/test/functional/vimscript/let_spec.lua @@ -15,12 +15,12 @@ before_each(clear) describe(':let', function() it('correctly lists variables with curly-braces', function() - meths.set_var('v', { 0 }) + meths.nvim_set_var('v', { 0 }) eq('v [0]', exec_capture('let {"v"}')) end) it('correctly lists variables with subscript', function() - meths.set_var('v', { 0 }) + meths.nvim_set_var('v', { 0 }) eq('v[0] #0', exec_capture('let v[0]')) eq('g:["v"][0] #0', exec_capture('let g:["v"][0]')) eq('{"g:"}["v"][0] #0', exec_capture('let {"g:"}["v"][0]')) @@ -100,17 +100,17 @@ describe(':let', function() end) it('can apply operator to boolean option', function() - eq(true, meths.get_option_value('equalalways', {})) + eq(true, meths.nvim_get_option_value('equalalways', {})) command('let &equalalways -= 1') - eq(false, meths.get_option_value('equalalways', {})) + eq(false, meths.nvim_get_option_value('equalalways', {})) command('let &equalalways += 1') - eq(true, meths.get_option_value('equalalways', {})) + eq(true, meths.nvim_get_option_value('equalalways', {})) command('let &equalalways *= 1') - eq(true, meths.get_option_value('equalalways', {})) + eq(true, meths.nvim_get_option_value('equalalways', {})) command('let &equalalways /= 1') - eq(true, meths.get_option_value('equalalways', {})) + eq(true, meths.nvim_get_option_value('equalalways', {})) command('let &equalalways %= 1') - eq(false, meths.get_option_value('equalalways', {})) + eq(false, meths.nvim_get_option_value('equalalways', {})) end) end) diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua index b0c4a9747a..e11c8af157 100644 --- a/test/functional/vimscript/map_functions_spec.lua +++ b/test/functional/vimscript/map_functions_spec.lua @@ -181,31 +181,31 @@ describe('mapset()', function() before_each(clear) it('can restore mapping with backslash in lhs', function() - meths.set_keymap('n', '\\ab', 'a', {}) + meths.nvim_set_keymap('n', '\\ab', 'a', {}) eq('\nn \\ab a', exec_capture('nmap \\ab')) local mapargs = funcs.maparg('\\ab', 'n', false, true) - meths.set_keymap('n', '\\ab', 'b', {}) + meths.nvim_set_keymap('n', '\\ab', 'b', {}) eq('\nn \\ab b', exec_capture('nmap \\ab')) funcs.mapset('n', false, mapargs) eq('\nn \\ab a', exec_capture('nmap \\ab')) end) it('can restore mapping description from the dict returned by maparg()', function() - meths.set_keymap('n', 'lhs', 'rhs', { desc = 'map description' }) + meths.nvim_set_keymap('n', 'lhs', 'rhs', { desc = 'map description' }) eq('\nn lhs rhs\n map description', exec_capture('nmap lhs')) local mapargs = funcs.maparg('lhs', 'n', false, true) - meths.set_keymap('n', 'lhs', 'rhs', { desc = 'MAP DESCRIPTION' }) + meths.nvim_set_keymap('n', 'lhs', 'rhs', { desc = 'MAP DESCRIPTION' }) eq('\nn lhs rhs\n MAP DESCRIPTION', exec_capture('nmap lhs')) funcs.mapset('n', false, mapargs) eq('\nn lhs rhs\n map description', exec_capture('nmap lhs')) end) it('can restore "replace_keycodes" from the dict returned by maparg()', function() - meths.set_keymap('i', 'foo', [['<l' .. 't>']], { expr = true, replace_keycodes = true }) + meths.nvim_set_keymap('i', 'foo', [['<l' .. 't>']], { expr = true, replace_keycodes = true }) feed('Afoo') expect('<') local mapargs = funcs.maparg('foo', 'i', false, true) - meths.set_keymap('i', 'foo', [['<l' .. 't>']], { expr = true }) + meths.nvim_set_keymap('i', 'foo', [['<l' .. 't>']], { expr = true }) feed('foo') expect('<<lt>') funcs.mapset('i', false, mapargs) diff --git a/test/functional/vimscript/null_spec.lua b/test/functional/vimscript/null_spec.lua index acdd844aff..efc3c451f8 100644 --- a/test/functional/vimscript/null_spec.lua +++ b/test/functional/vimscript/null_spec.lua @@ -9,15 +9,15 @@ local funcs = helpers.funcs local eq = helpers.eq local function redir_exec(cmd) - meths.set_var('__redir_exec_cmd', cmd) + meths.nvim_set_var('__redir_exec_cmd', cmd) command([[ redir => g:__redir_exec_output silent! execute g:__redir_exec_cmd redir END ]]) - local ret = meths.get_var('__redir_exec_output') - meths.del_var('__redir_exec_output') - meths.del_var('__redir_exec_cmd') + local ret = meths.nvim_get_var('__redir_exec_output') + meths.nvim_del_var('__redir_exec_output') + meths.nvim_del_var('__redir_exec_cmd') return ret end @@ -44,7 +44,7 @@ describe('NULL', function() if val == nil then eq(0, funcs.exists('g:_var')) else - eq(val, meths.get_var('_var')) + eq(val, meths.nvim_get_var('_var')) end if after ~= nil then after() diff --git a/test/functional/vimscript/printf_spec.lua b/test/functional/vimscript/printf_spec.lua index 248a33c92b..f9a7199f11 100644 --- a/test/functional/vimscript/printf_spec.lua +++ b/test/functional/vimscript/printf_spec.lua @@ -65,12 +65,12 @@ describe('printf()', function() local seen_rets = {} -- Collect all args in an array to avoid possible allocation of the same -- address after freeing unreferenced values. - meths.set_var('__args', {}) + meths.nvim_set_var('__args', {}) local function check_printf(expr, is_null) eq(0, exc_exec('call add(__args, ' .. expr .. ')')) eq(0, exc_exec('let __result = printf("%p", __args[-1])')) local id_ret = eval('id(__args[-1])') - eq(id_ret, meths.get_var('__result')) + eq(id_ret, meths.nvim_get_var('__result')) if is_null then if null_ret then eq(null_ret, id_ret) @@ -81,7 +81,7 @@ describe('printf()', function() eq(nil, seen_rets[id_ret]) seen_rets[id_ret] = expr end - meths.del_var('__result') + meths.nvim_del_var('__result') end check_printf('v:_null_list', true) check_printf('v:_null_dict', true) diff --git a/test/functional/vimscript/screenchar_spec.lua b/test/functional/vimscript/screenchar_spec.lua index 5df9c480e8..f24aa87ff4 100644 --- a/test/functional/vimscript/screenchar_spec.lua +++ b/test/functional/vimscript/screenchar_spec.lua @@ -14,15 +14,15 @@ local setup_floating_windows = function() border = 'none', } - local bufnr_1 = meths.create_buf(false, true) - meths.buf_set_lines(bufnr_1, 0, -1, true, { 'aa' }) + local bufnr_1 = meths.nvim_create_buf(false, true) + meths.nvim_buf_set_lines(bufnr_1, 0, -1, true, { 'aa' }) local opts_1 = tbl_deep_extend('force', { row = 0, col = 0, zindex = 11 }, base_opts) - meths.open_win(bufnr_1, false, opts_1) + meths.nvim_open_win(bufnr_1, false, opts_1) - local bufnr_2 = meths.create_buf(false, true) - meths.buf_set_lines(bufnr_2, 0, -1, true, { 'bb' }) + local bufnr_2 = meths.nvim_create_buf(false, true) + meths.nvim_buf_set_lines(bufnr_2, 0, -1, true, { 'bb' }) local opts_2 = tbl_deep_extend('force', { row = 0, col = 1, zindex = 10 }, base_opts) - meths.open_win(bufnr_2, false, opts_2) + meths.nvim_open_win(bufnr_2, false, opts_2) command('redraw') end @@ -32,7 +32,7 @@ describe('screenchar() and family respect floating windows', function() clear() -- These commands result into visible text `aabc`. -- `aab` - from floating windows, `c` - from text in regular window. - meths.buf_set_lines(0, 0, -1, true, { 'cccc' }) + meths.nvim_buf_set_lines(0, 0, -1, true, { 'cccc' }) setup_floating_windows() end) diff --git a/test/functional/vimscript/screenpos_spec.lua b/test/functional/vimscript/screenpos_spec.lua index 934dd1cfe1..7edfcac28b 100644 --- a/test/functional/vimscript/screenpos_spec.lua +++ b/test/functional/vimscript/screenpos_spec.lua @@ -18,33 +18,33 @@ describe('screenpos() function', function() border = 'none', focusable = 1, } - local float = meths.open_win(meths.create_buf(false, true), false, opts) + local float = meths.nvim_open_win(meths.nvim_create_buf(false, true), false, opts) command('redraw') eq({ row = 7, col = 9, endcol = 9, curscol = 9 }, funcs.screenpos(float, 1, 1)) -- only left border opts.border = { '', '', '', '', '', '', '', '|' } - meths.win_set_config(float, opts) + meths.nvim_win_set_config(float, opts) command('redraw') eq({ row = 7, col = 10, endcol = 10, curscol = 10 }, funcs.screenpos(float, 1, 1)) -- only top border opts.border = { '', '_', '', '', '', '', '', '' } - meths.win_set_config(float, opts) + meths.nvim_win_set_config(float, opts) command('redraw') eq({ row = 8, col = 9, endcol = 9, curscol = 9 }, funcs.screenpos(float, 1, 1)) -- both left and top border opts.border = 'single' - meths.win_set_config(float, opts) + meths.nvim_win_set_config(float, opts) command('redraw') eq({ row = 8, col = 10, endcol = 10, curscol = 10 }, funcs.screenpos(float, 1, 1)) end) it('works for folded line with virt_lines attached to line above', function() - meths.buf_set_lines(0, 0, -1, true, { 'aaa', 'bbb', 'ccc', 'ddd' }) - local ns = meths.create_namespace('') - meths.buf_set_extmark( + meths.nvim_buf_set_lines(0, 0, -1, true, { 'aaa', 'bbb', 'ccc', 'ddd' }) + local ns = meths.nvim_create_namespace('') + meths.nvim_buf_set_extmark( 0, ns, 0, diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua index 7b8a98d5fc..9d2bfbafc8 100644 --- a/test/functional/vimscript/server_spec.lua +++ b/test/functional/vimscript/server_spec.lua @@ -52,7 +52,7 @@ describe('server', function() it('sets v:servername at startup or if all servers were stopped', function() clear() - local initial_server = meths.get_vvar('servername') + local initial_server = meths.nvim_get_vvar('servername') assert(initial_server ~= nil and initial_server:len() > 0, 'v:servername was not initialized') -- v:servername is readonly so we cannot unset it--but we can test that it @@ -63,11 +63,11 @@ describe('server', function() -- serverstop() does _not_ modify v:servername... eq(1, funcs.serverstop(s)) - eq(initial_server, meths.get_vvar('servername')) + eq(initial_server, meths.nvim_get_vvar('servername')) -- ...unless we stop _all_ servers. eq(1, funcs.serverstop(funcs.serverlist()[1])) - eq('', meths.get_vvar('servername')) + eq('', meths.nvim_get_vvar('servername')) -- v:servername and $NVIM take the next available server. local servername = ( @@ -75,7 +75,7 @@ describe('server', function() or './Xtest-functional-server-socket' ) funcs.serverstart(servername) - eq(servername, meths.get_vvar('servername')) + eq(servername, meths.nvim_get_vvar('servername')) -- Not set in the current process, only in children. eq('', eval('$NVIM')) end) @@ -185,10 +185,10 @@ describe('startup --listen', function() it('sets v:servername, overrides $NVIM_LISTEN_ADDRESS', function() local addr = (is_os('win') and [[\\.\pipe\Xtest-listen-pipe]] or './Xtest-listen-pipe') clear({ env = { NVIM_LISTEN_ADDRESS = './Xtest-env-pipe' }, args = { '--listen', addr } }) - eq(addr, meths.get_vvar('servername')) + eq(addr, meths.nvim_get_vvar('servername')) -- Address without slashes is a "name" which is appended to a generated path. #8519 clear({ args = { '--listen', 'test-name' } }) - matches([[.*[/\\]test%-name[^/\\]*]], meths.get_vvar('servername')) + matches([[.*[/\\]test%-name[^/\\]*]], meths.nvim_get_vvar('servername')) end) end) diff --git a/test/functional/vimscript/sort_spec.lua b/test/functional/vimscript/sort_spec.lua index ca769b9f16..25242791c2 100644 --- a/test/functional/vimscript/sort_spec.lua +++ b/test/functional/vimscript/sort_spec.lua @@ -21,7 +21,7 @@ describe('sort()', function() end) it('sorts “wrong” values between -0.0001 and 0.0001, preserving order', function() - meths.set_var('list', { + meths.nvim_set_var('list', { true, false, NIL, diff --git a/test/functional/vimscript/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua index 80c3c45561..a76bb78b6f 100644 --- a/test/functional/vimscript/special_vars_spec.lua +++ b/test/functional/vimscript/special_vars_spec.lua @@ -107,8 +107,8 @@ describe('Special values', function() end) it('does not work with +=/-=/.=', function() - meths.set_var('true', true) - meths.set_var('false', false) + meths.nvim_set_var('true', true) + meths.nvim_set_var('false', false) command('let null = v:null') eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let true += 1')) @@ -172,7 +172,7 @@ describe('Special values', function() 'Expected False but got v:null', 'Expected True but got v:false', 'Expected True but got v:null', - }, meths.get_vvar('errors')) + }, meths.nvim_get_vvar('errors')) end) describe('compat', function() diff --git a/test/functional/vimscript/state_spec.lua b/test/functional/vimscript/state_spec.lua index e93989ef80..f9a21c5881 100644 --- a/test/functional/vimscript/state_spec.lua +++ b/test/functional/vimscript/state_spec.lua @@ -12,7 +12,7 @@ before_each(clear) describe('state() function', function() -- oldtest: Test_state() it('works', function() - meths.ui_attach(80, 24, {}) -- Allow hit-enter-prompt + meths.nvim_ui_attach(80, 24, {}) -- Allow hit-enter-prompt exec_lua([[ function _G.Get_state_mode() @@ -48,7 +48,7 @@ describe('state() function', function() -- Halfway a mapping feed([[:call v:lua.Run_timer()<CR>;]]) - meths.get_mode() -- Process pending input and luv timer callback + meths.nvim_get_mode() -- Process pending input and luv timer callback feed(';') eq({ 'mS', 'n' }, exec_lua('return _G.res')) @@ -79,7 +79,7 @@ describe('state() function', function() -- messages scrolled feed([[:call v:lua.Run_timer() | echo "one\ntwo\nthree"<CR>]]) - meths.get_mode() -- Process pending input and luv timer callback + meths.nvim_get_mode() -- Process pending input and luv timer callback feed('<CR>') eq({ 'Ss', 'r' }, exec_lua('return _G.res')) end) diff --git a/test/functional/vimscript/string_spec.lua b/test/functional/vimscript/string_spec.lua index aa93ddb27f..cb63404c00 100644 --- a/test/functional/vimscript/string_spec.lua +++ b/test/functional/vimscript/string_spec.lua @@ -161,7 +161,7 @@ describe('string() function', function() end) it('does not crash or halt when dumping partials with reference cycles in self', function() - meths.set_var('d', { v = true }) + meths.nvim_set_var('d', { v = true }) eq( [[Vim(echo):E724: unable to correctly dump variable with self-referencing container]], pcall_err(command, 'echo string(extend(extend(g:d, {"f": g:Test2_f}), {"p": g:d.f}))') @@ -186,7 +186,7 @@ describe('string() function', function() end) it('does not crash or halt when dumping partials with reference cycles in arguments', function() - meths.set_var('l', {}) + meths.nvim_set_var('l', {}) eval('add(l, l)') -- Regression: the below line used to crash (add returns original list and -- there was error in dumping partials). Tested explicitly in @@ -201,8 +201,8 @@ describe('string() function', function() it( 'does not crash or halt when dumping partials with reference cycles in self and arguments', function() - meths.set_var('d', { v = true }) - meths.set_var('l', {}) + meths.nvim_set_var('d', { v = true }) + meths.nvim_set_var('l', {}) eval('add(l, l)') eval('add(l, function("Test1", l))') eval('add(l, function("Test1", d))') @@ -231,7 +231,7 @@ describe('string() function', function() end) it('errors when dumping recursive lists', function() - meths.set_var('l', {}) + meths.nvim_set_var('l', {}) eval('add(l, l)') eq( 'Vim(echo):E724: unable to correctly dump variable with self-referencing container', @@ -240,7 +240,7 @@ describe('string() function', function() end) it('dumps recursive lists despite the error', function() - meths.set_var('l', {}) + meths.nvim_set_var('l', {}) eval('add(l, l)') eq( 'Vim(echo):E724: unable to correctly dump variable with self-referencing container', @@ -270,7 +270,7 @@ describe('string() function', function() end) it('errors when dumping recursive dictionaries', function() - meths.set_var('d', { d = 1 }) + meths.nvim_set_var('d', { d = 1 }) eval('extend(d, {"d": d})') eq( 'Vim(echo):E724: unable to correctly dump variable with self-referencing container', @@ -279,7 +279,7 @@ describe('string() function', function() end) it('dumps recursive dictionaries despite the error', function() - meths.set_var('d', { d = 1 }) + meths.nvim_set_var('d', { d = 1 }) eval('extend(d, {"d": d})') eq( 'Vim(echo):E724: unable to correctly dump variable with self-referencing container', diff --git a/test/functional/vimscript/writefile_spec.lua b/test/functional/vimscript/writefile_spec.lua index f03baa6ddd..4de542f293 100644 --- a/test/functional/vimscript/writefile_spec.lua +++ b/test/functional/vimscript/writefile_spec.lua @@ -100,7 +100,7 @@ describe('writefile()', function() end) it('shows correct file name when supplied numbers', function() - meths.set_current_dir(dname) + meths.nvim_set_current_dir(dname) eq( "Vim(call):E482: Can't open file 2 for writing: illegal operation on a directory", pcall_err(command, ('call writefile([42], %s)'):format(ddname_tail)) |