diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 12:44:54 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 13:01:06 +0000 |
commit | c30f2e3182e3b50e7c03932027ac55edfc8ada4a (patch) | |
tree | edf0a76dba282d946f67fe70fff8c6cbe28e7a82 /test/functional/ex_cmds | |
parent | 284e0ad26dd9de90c3a813dd1b357a425eca6bad (diff) | |
download | rneovim-c30f2e3182e3b50e7c03932027ac55edfc8ada4a.tar.gz rneovim-c30f2e3182e3b50e7c03932027ac55edfc8ada4a.tar.bz2 rneovim-c30f2e3182e3b50e7c03932027ac55edfc8ada4a.zip |
test: typing for helpers.meths
Diffstat (limited to 'test/functional/ex_cmds')
-rw-r--r-- | test/functional/ex_cmds/append_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ex_cmds/echo_spec.lua | 16 | ||||
-rw-r--r-- | test/functional/ex_cmds/help_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ex_cmds/highlight_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ex_cmds/map_spec.lua | 24 | ||||
-rw-r--r-- | test/functional/ex_cmds/mksession_spec.lua | 30 | ||||
-rw-r--r-- | test/functional/ex_cmds/oldfiles_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ex_cmds/script_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ex_cmds/source_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/ex_cmds/swapfile_preserve_recover_spec.lua | 10 | ||||
-rw-r--r-- | test/functional/ex_cmds/verbose_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ex_cmds/write_spec.lua | 8 |
12 files changed, 65 insertions, 65 deletions
diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua index b3c0584568..4bd323a763 100644 --- a/test/functional/ex_cmds/append_spec.lua +++ b/test/functional/ex_cmds/append_spec.lua @@ -42,7 +42,7 @@ local cmdtest = function(cmd, prep, ret1) eq(hisline, funcs.histget(':', -2)) eq(cmd, funcs.histget(':')) -- Test that command-line window was launched - eq('nofile', meths.get_option_value('buftype', {})) + eq('nofile', meths.nvim_get_option_value('buftype', {})) eq('n', funcs.mode(1)) feed('<CR>') eq('c', funcs.mode(1)) diff --git a/test/functional/ex_cmds/echo_spec.lua b/test/functional/ex_cmds/echo_spec.lua index 87bc15ceca..bfc8f57632 100644 --- a/test/functional/ex_cmds/echo_spec.lua +++ b/test/functional/ex_cmds/echo_spec.lua @@ -223,7 +223,7 @@ describe(':echo :echon :echomsg :echoerr', 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( dedent( [[ @@ -251,7 +251,7 @@ describe(':echo :echon :echomsg :echoerr', 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 @@ -269,8 +269,8 @@ describe(':echo :echon :echomsg :echoerr', 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))') @@ -305,13 +305,13 @@ describe(':echo :echon :echomsg :echoerr', function() end) it('does not error when dumping recursive lists', function() - meths.set_var('l', {}) + meths.nvim_set_var('l', {}) eval('add(l, l)') eq(0, exc_exec('echo String(l)')) end) it('dumps recursive lists without error', function() - meths.set_var('l', {}) + meths.nvim_set_var('l', {}) eval('add(l, l)') eq('[[...@0]]', exec_capture('echo String(l)')) eq('[[[...@1]]]', exec_capture('echo String([l])')) @@ -335,13 +335,13 @@ describe(':echo :echon :echomsg :echoerr', function() end) it('does not error when dumping recursive dictionaries', function() - meths.set_var('d', { d = 1 }) + meths.nvim_set_var('d', { d = 1 }) eval('extend(d, {"d": d})') eq(0, exc_exec('echo String(d)')) end) it('dumps recursive dictionaries without the error', function() - meths.set_var('d', { d = 1 }) + meths.nvim_set_var('d', { d = 1 }) eval('extend(d, {"d": d})') eq("{'d': {...@0}}", exec_capture('echo String(d)')) eq("{'out': {'d': {...@1}}}", exec_capture('echo String({"out": d})')) diff --git a/test/functional/ex_cmds/help_spec.lua b/test/functional/ex_cmds/help_spec.lua index aca0cbbaa6..de79fadd6d 100644 --- a/test/functional/ex_cmds/help_spec.lua +++ b/test/functional/ex_cmds/help_spec.lua @@ -40,6 +40,6 @@ describe(':help', function() command('helptags Xhelptags/doc') command('set rtp+=Xhelptags') command('help …') - eq('*…*', meths.get_current_line()) + eq('*…*', meths.nvim_get_current_line()) end) end) diff --git a/test/functional/ex_cmds/highlight_spec.lua b/test/functional/ex_cmds/highlight_spec.lua index 6aac8c2e3a..f572728b4d 100644 --- a/test/functional/ex_cmds/highlight_spec.lua +++ b/test/functional/ex_cmds/highlight_spec.lua @@ -53,11 +53,11 @@ describe(':highlight', function() end) it('clear', function() - meths.set_var('colors_name', 'foo') + meths.nvim_set_var('colors_name', 'foo') eq(1, funcs.exists('g:colors_name')) command('hi clear') eq(0, funcs.exists('g:colors_name')) - meths.set_var('colors_name', 'foo') + meths.nvim_set_var('colors_name', 'foo') eq(1, funcs.exists('g:colors_name')) exec([[ func HiClear() diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua index 934dac6a2d..16df6f58b5 100644 --- a/test/functional/ex_cmds/map_spec.lua +++ b/test/functional/ex_cmds/map_spec.lua @@ -16,13 +16,13 @@ describe(':*map', function() before_each(clear) it('are not affected by &isident', function() - meths.set_var('counter', 0) + meths.nvim_set_var('counter', 0) command('nnoremap <C-x> :let counter+=1<CR>') - meths.set_option_value('isident', ('%u'):format(('>'):byte()), {}) + meths.nvim_set_option_value('isident', ('%u'):format(('>'):byte()), {}) command('nnoremap <C-y> :let counter+=1<CR>') -- &isident used to disable keycode parsing here as well feed('\24\25<C-x><C-y>') - eq(4, meths.get_var('counter')) + eq(4, meths.nvim_get_var('counter')) end) it(':imap <M-">', function() @@ -42,9 +42,9 @@ n asdf <Nop>]], end) it('mappings with description can be filtered', function() - meths.set_keymap('n', 'asdf1', 'qwert', { desc = 'do the one thing' }) - meths.set_keymap('n', 'asdf2', 'qwert', { desc = 'doesnot really do anything' }) - meths.set_keymap('n', 'asdf3', 'qwert', { desc = 'do the other thing' }) + meths.nvim_set_keymap('n', 'asdf1', 'qwert', { desc = 'do the one thing' }) + meths.nvim_set_keymap('n', 'asdf2', 'qwert', { desc = 'doesnot really do anything' }) + meths.nvim_set_keymap('n', 'asdf3', 'qwert', { desc = 'do the other thing' }) eq( [[ @@ -58,21 +58,21 @@ n asdf1 qwert it('<Plug> mappings ignore nore', function() command('let x = 0') - eq(0, meths.eval('x')) + eq(0, meths.nvim_eval('x')) command [[ nnoremap <Plug>(Increase_x) <cmd>let x+=1<cr> nmap increase_x_remap <Plug>(Increase_x) nnoremap increase_x_noremap <Plug>(Increase_x) ]] feed('increase_x_remap') - eq(1, meths.eval('x')) + eq(1, meths.nvim_eval('x')) feed('increase_x_noremap') - eq(2, meths.eval('x')) + eq(2, meths.nvim_eval('x')) end) it("Doesn't auto ignore nore for keys before or after <Plug> mapping", function() command('let x = 0') - eq(0, meths.eval('x')) + eq(0, meths.nvim_eval('x')) command [[ nnoremap x <nop> nnoremap <Plug>(Increase_x) <cmd>let x+=1<cr> @@ -83,10 +83,10 @@ n asdf1 qwert eq('Some text', eval("getline('.')")) feed('increase_x_remap') - eq(1, meths.eval('x')) + eq(1, meths.nvim_eval('x')) eq('Some text', eval("getline('.')")) feed('increase_x_noremap') - eq(2, meths.eval('x')) + eq(2, meths.nvim_eval('x')) eq('Some te', eval("getline('.')")) end) diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua index cc3a81f7dd..2a62bff6e9 100644 --- a/test/functional/ex_cmds/mksession_spec.lua +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -70,7 +70,7 @@ describe(':mksession', function() -- Restore session. command('source ' .. session_file) - eq(expected_buf_count, #meths.list_bufs()) + eq(expected_buf_count, #meths.nvim_list_bufs()) end it( @@ -80,28 +80,28 @@ describe(':mksession', function() command('edit ' .. tmpfile_base) command('terminal') - local buf_count = #meths.list_bufs() + local buf_count = #meths.nvim_list_bufs() eq(2, buf_count) - eq('terminal', meths.get_option_value('buftype', {})) + eq('terminal', meths.nvim_get_option_value('buftype', {})) test_terminal_session_disabled(2) -- no terminal should be set. As a side effect we end up with a blank buffer - eq('', meths.get_option_value('buftype', { buf = meths.list_bufs()[1] })) - eq('', meths.get_option_value('buftype', { buf = meths.list_bufs()[2] })) + eq('', meths.nvim_get_option_value('buftype', { buf = meths.nvim_list_bufs()[1] })) + eq('', meths.nvim_get_option_value('buftype', { buf = meths.nvim_list_bufs()[2] })) end ) it('do not restore :terminal if not set in sessionoptions, terminal hidden #13078', function() command('terminal') - local terminal_bufnr = meths.get_current_buf() + local terminal_bufnr = meths.nvim_get_current_buf() local tmpfile_base = file_prefix .. '-tmpfile' -- make terminal hidden by opening a new file command('edit ' .. tmpfile_base .. '1') - local buf_count = #meths.list_bufs() + local buf_count = #meths.nvim_list_bufs() eq(2, buf_count) eq(1, funcs.getbufinfo(terminal_bufnr)[1].hidden) @@ -109,20 +109,20 @@ describe(':mksession', function() test_terminal_session_disabled(1) -- no terminal should exist here - neq('', meths.buf_get_name(meths.list_bufs()[1])) + neq('', meths.nvim_buf_get_name(meths.nvim_list_bufs()[1])) end) it('do not restore :terminal if not set in sessionoptions, only buffer #13078', function() command('terminal') - eq('terminal', meths.get_option_value('buftype', {})) + eq('terminal', meths.nvim_get_option_value('buftype', {})) - local buf_count = #meths.list_bufs() + local buf_count = #meths.nvim_list_bufs() eq(1, buf_count) test_terminal_session_disabled(1) -- no terminal should be set - eq('', meths.get_option_value('buftype', {})) + eq('', meths.nvim_get_option_value('buftype', {})) end) it('restores tab-local working directories', function() @@ -238,7 +238,7 @@ describe(':mksession', function() local tmpfile = file_prefix .. '-tmpfile-float' command('edit ' .. tmpfile) - local buf = meths.create_buf(false, true) + local buf = meths.nvim_create_buf(false, true) local config = { relative = 'editor', focusable = false, @@ -248,8 +248,8 @@ describe(':mksession', function() col = 1, style = 'minimal', } - meths.open_win(buf, false, config) - local cmdheight = meths.get_option_value('cmdheight', {}) + meths.nvim_open_win(buf, false, config) + local cmdheight = meths.nvim_get_option_value('cmdheight', {}) command('mksession ' .. session_file) -- Create a new test instance of Nvim. @@ -262,7 +262,7 @@ describe(':mksession', function() -- window was not restored. eq(1, funcs.winnr('$')) -- The command-line height should remain the same as it was. - eq(cmdheight, meths.get_option_value('cmdheight', {})) + eq(cmdheight, meths.nvim_get_option_value('cmdheight', {})) os.remove(tmpfile) end) diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua index 11bebb3793..8330395ed1 100644 --- a/test/functional/ex_cmds/oldfiles_spec.lua +++ b/test/functional/ex_cmds/oldfiles_spec.lua @@ -42,7 +42,7 @@ describe(':oldfiles', function() feed_command('edit testfile2') feed_command('wshada') feed_command('rshada!') - local oldfiles = helpers.meths.get_vvar('oldfiles') + local oldfiles = helpers.meths.nvim_get_vvar('oldfiles') feed_command('oldfiles') screen:expect([[ | @@ -108,7 +108,7 @@ describe(':browse oldfiles', function() -- Ensure v:oldfiles isn't busted. Since things happen so fast, -- the ordering of v:oldfiles is unstable (it uses qsort() under-the-hood). -- Let's verify the contents and the length of v:oldfiles before moving on. - oldfiles = helpers.meths.get_vvar('oldfiles') + oldfiles = helpers.meths.nvim_get_vvar('oldfiles') eq(2, #oldfiles) ok(filename == oldfiles[1] or filename == oldfiles[2]) ok(filename2 == oldfiles[1] or filename2 == oldfiles[2]) diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua index 465397169a..20fd65fc69 100644 --- a/test/functional/ex_cmds/script_spec.lua +++ b/test/functional/ex_cmds/script_spec.lua @@ -83,7 +83,7 @@ describe('script_get-based command', function() ]])):format(cmd, garbage) ) ) - neq(0, meths.get_var('exc')) + neq(0, meths.nvim_get_var('exc')) end end) end) diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua index e822fe78b8..765f5d4b05 100644 --- a/test/functional/ex_cmds/source_spec.lua +++ b/test/functional/ex_cmds/source_spec.lua @@ -49,7 +49,7 @@ describe(':source', function() pending("'shellslash' only works on Windows") return end - meths.set_option_value('shellslash', false, {}) + meths.nvim_set_option_value('shellslash', false, {}) mkdir('Xshellslash') write_file( @@ -65,9 +65,9 @@ describe(':source', function() for _ = 1, 2 do command([[source Xshellslash/Xstack.vim]]) - matches([[Xshellslash\Xstack%.vim]], meths.get_var('stack1')) - matches([[Xshellslash/Xstack%.vim]], meths.get_var('stack2')) - matches([[Xshellslash\Xstack%.vim]], meths.get_var('stack3')) + matches([[Xshellslash\Xstack%.vim]], meths.nvim_get_var('stack1')) + matches([[Xshellslash/Xstack%.vim]], meths.nvim_get_var('stack2')) + matches([[Xshellslash\Xstack%.vim]], meths.nvim_get_var('stack3')) end write_file( @@ -83,9 +83,9 @@ describe(':source', function() for _ = 1, 2 do command([[source Xshellslash/Xstack.lua]]) - matches([[Xshellslash\Xstack%.lua]], meths.get_var('stack1')) - matches([[Xshellslash/Xstack%.lua]], meths.get_var('stack2')) - matches([[Xshellslash\Xstack%.lua]], meths.get_var('stack3')) + matches([[Xshellslash\Xstack%.lua]], meths.nvim_get_var('stack1')) + matches([[Xshellslash/Xstack%.lua]], meths.nvim_get_var('stack2')) + matches([[Xshellslash\Xstack%.lua]], meths.nvim_get_var('stack3')) end rmdir('Xshellslash') @@ -182,9 +182,9 @@ describe(':source', function() command('set shellslash') command('source ' .. test_file) eq(1, eval('g:sourced_lua')) - matches([[/test%.lua$]], meths.get_var('sfile_value')) - matches([[/test%.lua$]], meths.get_var('stack_value')) - matches([[/test%.lua$]], meths.get_var('script_value')) + matches([[/test%.lua$]], meths.nvim_get_var('sfile_value')) + matches([[/test%.lua$]], meths.nvim_get_var('stack_value')) + matches([[/test%.lua$]], meths.nvim_get_var('script_value')) os.remove(test_file) end) @@ -229,9 +229,9 @@ describe(':source', function() eq(12, eval('g:c')) eq(' \\ 1\n "\\ 2', exec_lua('return _G.a')) - eq(':source (no file)', meths.get_var('sfile_value')) - eq(':source (no file)', meths.get_var('stack_value')) - eq(':source (no file)', meths.get_var('script_value')) + eq(':source (no file)', meths.nvim_get_var('sfile_value')) + eq(':source (no file)', meths.nvim_get_var('stack_value')) + eq(':source (no file)', meths.nvim_get_var('script_value')) end) end diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index 105b488f69..99191a2a57 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -438,7 +438,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() feed('Gisometext<esc>') poke_eventloop() clear() -- Leaves a swap file behind - meths.ui_attach(80, 30, {}) + meths.nvim_ui_attach(80, 30, {}) end) after_each(function() rmdir(swapdir) @@ -459,7 +459,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() eval("getline('$')->trim(' ', 2)") ) end) - meths.chan_send(chan, 'q') + meths.nvim_chan_send(chan, 'q') retry(nil, nil, function() eq( { '', '[Process exited 1]', '' }, @@ -491,7 +491,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() eval("getline('$')->trim(' ', 2)") ) end) - meths.chan_send(chan, 'a') + meths.nvim_chan_send(chan, 'a') retry(nil, nil, function() eq( { '', '[Process exited 1]', '' }, @@ -531,11 +531,11 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() eval("getline('$')->trim(' ', 2)") ) end) - meths.chan_send(chan, 'q') + meths.nvim_chan_send(chan, 'q') retry(nil, nil, function() eq('Press ENTER or type command to continue', eval("getline('$')->trim(' ', 2)")) end) - meths.chan_send(chan, '\r') + meths.nvim_chan_send(chan, '\r') retry(nil, nil, function() eq( { '', '[Process exited 1]', '' }, diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua index 17f13e0090..dbc81cf5d8 100644 --- a/test/functional/ex_cmds/verbose_spec.lua +++ b/test/functional/ex_cmds/verbose_spec.lua @@ -5,7 +5,7 @@ local eq = helpers.eq local exec = helpers.exec local exec_capture = helpers.exec_capture local write_file = helpers.write_file -local call_viml_function = helpers.meths.call_function +local call_viml_function = helpers.meths.nvim_call_function local function last_set_tests(cmd) local script_location, script_file diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua index a363578ce6..403e3426f9 100644 --- a/test/functional/ex_cmds/write_spec.lua +++ b/test/functional/ex_cmds/write_spec.lua @@ -133,17 +133,17 @@ describe(':write', function() pcall_err(command, 'write .') ) end - meths.set_option_value('writeany', true, {}) + meths.nvim_set_option_value('writeany', true, {}) -- Message from buf_write eq('Vim(write):E502: "." is a directory', pcall_err(command, 'write .')) funcs.mkdir(fname_bak) - meths.set_option_value('backupdir', '.', {}) - meths.set_option_value('backup', true, {}) + meths.nvim_set_option_value('backupdir', '.', {}) + meths.nvim_set_option_value('backup', true, {}) write_file(fname, 'content0') command('edit ' .. fname) funcs.setline(1, 'TTY') eq("Vim(write):E510: Can't make backup file (add ! to override)", pcall_err(command, 'write')) - meths.set_option_value('backup', false, {}) + meths.nvim_set_option_value('backup', false, {}) funcs.setfperm(fname, 'r--------') eq( 'Vim(write):E505: "Xtest-functional-ex_cmds-write" is read-only (add ! to override)', |