diff options
Diffstat (limited to 'test/functional/autocmd')
-rw-r--r-- | test/functional/autocmd/autocmd_oldtest_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/autocmd/autocmd_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/autocmd/cmdline_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/autocmd/cursorhold_spec.lua | 30 | ||||
-rw-r--r-- | test/functional/autocmd/cursormoved_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/autocmd/safestate_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/autocmd/termxx_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/autocmd/win_scrolled_resized_spec.lua | 38 |
8 files changed, 71 insertions, 64 deletions
diff --git a/test/functional/autocmd/autocmd_oldtest_spec.lua b/test/functional/autocmd/autocmd_oldtest_spec.lua index 62f87bfd97..fb566e27c3 100644 --- a/test/functional/autocmd/autocmd_oldtest_spec.lua +++ b/test/functional/autocmd/autocmd_oldtest_spec.lua @@ -23,7 +23,7 @@ describe('oldtests', function() ]] eq(3, #exec_lines('au vimBarTest')) - eq(1, #meths.get_autocmds({ group = 'vimBarTest' })) + eq(1, #meths.nvim_get_autocmds({ group = 'vimBarTest' })) end it('should recognize a bar before the {event}', function() @@ -31,7 +31,7 @@ describe('oldtests', function() add_an_autocmd() exec [[ augroup vimBarTest | au! | augroup END ]] eq(1, #exec_lines('au vimBarTest')) - eq({}, meths.get_autocmds({ group = 'vimBarTest' })) + eq({}, meths.nvim_get_autocmds({ group = 'vimBarTest' })) -- Sad spacing add_an_autocmd() @@ -74,7 +74,7 @@ describe('oldtests', function() funcs.writefile(funcs.split(content, '\n'), fname) funcs.delete('Xout') - funcs.system(string.format('%s --clean -N -S %s', meths.get_vvar('progpath'), fname)) + funcs.system(string.format('%s --clean -N -S %s', meths.nvim_get_vvar('progpath'), fname)) eq(1, funcs.filereadable('Xout')) funcs.delete('Xxx1') diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index 2ae6277bd9..5088ef8031 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -143,7 +143,7 @@ describe('autocmd', function() describe('BufLeave autocommand', function() it('can wipe out the buffer created by :edit which triggered autocmd', function() - meths.set_option_value('hidden', true, {}) + meths.nvim_set_option_value('hidden', true, {}) curbufmeths.set_lines(0, 1, false, { 'start of test file xx', 'end of test file xx', @@ -416,7 +416,11 @@ describe('autocmd', function() end) it('gives E814 when there are other floating windows', function() - meths.open_win(0, true, { width = 10, height = 10, relative = 'editor', row = 10, col = 10 }) + meths.nvim_open_win( + 0, + true, + { width = 10, height = 10, relative = 'editor', row = 10, col = 10 } + ) eq( 'BufAdd Autocommands for "Xa.txt": Vim(close):E814: Cannot close window, only autocmd window would remain', pcall_err(command, 'doautoall BufAdd') @@ -512,15 +516,15 @@ describe('autocmd', function() command('autocmd ChanOpen * let v:event.info.id = 0') funcs.jobstart({ 'cat' }) retry(nil, nil, function() - eq('E46: Cannot change read-only variable "v:event.info"', meths.get_vvar('errmsg')) + eq('E46: Cannot change read-only variable "v:event.info"', meths.nvim_get_vvar('errmsg')) end) end) it('during ChanOpen event', function() command('autocmd ChanInfo * let v:event.info.id = 0') - meths.set_client_info('foo', {}, 'remote', {}, {}) + meths.nvim_set_client_info('foo', {}, 'remote', {}, {}) retry(nil, nil, function() - eq('E46: Cannot change read-only variable "v:event.info"', meths.get_vvar('errmsg')) + eq('E46: Cannot change read-only variable "v:event.info"', meths.nvim_get_vvar('errmsg')) end) end) @@ -574,7 +578,7 @@ describe('autocmd', function() call assert_fails('au WinNew * ++once ++once echo bad', 'E983:') ]] - meths.set_var('did_split', 0) + meths.nvim_set_var('did_split', 0) source [[ augroup Testing @@ -586,11 +590,11 @@ describe('autocmd', function() split ]] - eq(2, meths.get_var('did_split')) + eq(2, meths.nvim_get_var('did_split')) eq(1, funcs.exists('#WinNew')) -- Now with once - meths.set_var('did_split', 0) + meths.nvim_set_var('did_split', 0) source [[ augroup Testing @@ -602,7 +606,7 @@ describe('autocmd', function() split ]] - eq(1, meths.get_var('did_split')) + eq(1, meths.nvim_get_var('did_split')) eq(0, funcs.exists('#WinNew')) -- call assert_fails('au WinNew * ++once ++once echo bad', 'E983:') @@ -619,7 +623,7 @@ describe('autocmd', function() it('should have autocmds in filetypedetect group', function() source [[filetype on]] - neq({}, meths.get_autocmds { group = 'filetypedetect' }) + neq({}, meths.nvim_get_autocmds { group = 'filetypedetect' }) end) it('should allow comma-separated patterns', function() @@ -631,7 +635,7 @@ describe('autocmd', function() augroup END ]] - eq(4, #meths.get_autocmds { event = 'BufReadCmd', group = 'TestingPatterns' }) + eq(4, #meths.nvim_get_autocmds { event = 'BufReadCmd', group = 'TestingPatterns' }) end) end) diff --git a/test/functional/autocmd/cmdline_spec.lua b/test/functional/autocmd/cmdline_spec.lua index 3502721ee0..11a320910c 100644 --- a/test/functional/autocmd/cmdline_spec.lua +++ b/test/functional/autocmd/cmdline_spec.lua @@ -14,8 +14,8 @@ describe('cmdline autocommands', function() local channel before_each(function() clear() - channel = meths.get_api_info()[1] - meths.set_var('channel', channel) + channel = meths.nvim_get_api_info()[1] + meths.nvim_set_var('channel', channel) command("autocmd CmdlineEnter * call rpcnotify(g:channel, 'CmdlineEnter', v:event)") command("autocmd CmdlineLeave * call rpcnotify(g:channel, 'CmdlineLeave', v:event)") command("autocmd CmdWinEnter * call rpcnotify(g:channel, 'CmdWinEnter', v:event)") diff --git a/test/functional/autocmd/cursorhold_spec.lua b/test/functional/autocmd/cursorhold_spec.lua index 67ccf86ea4..58c50c9922 100644 --- a/test/functional/autocmd/cursorhold_spec.lua +++ b/test/functional/autocmd/cursorhold_spec.lua @@ -26,47 +26,47 @@ describe('CursorHold', function() -- if testing with small 'updatetime' fails, double its value and test again retry(10, nil, function() ut = ut * 2 - meths.set_option_value('updatetime', ut, {}) + meths.nvim_set_option_value('updatetime', ut, {}) feed('0') -- reset did_cursorhold - meths.set_var('cursorhold', 0) + meths.nvim_set_var('cursorhold', 0) sleep(ut / 4) fn() - eq(0, meths.get_var('cursorhold')) + eq(0, meths.nvim_get_var('cursorhold')) sleep(ut / 2) fn() - eq(0, meths.get_var('cursorhold')) + eq(0, meths.nvim_get_var('cursorhold')) sleep(ut / 2) - eq(early, meths.get_var('cursorhold')) + eq(early, meths.nvim_get_var('cursorhold')) sleep(ut / 4 * 3) - eq(1, meths.get_var('cursorhold')) + eq(1, meths.nvim_get_var('cursorhold')) end) end - local ignore_key = meths.replace_termcodes('<Ignore>', true, true, true) + local ignore_key = meths.nvim_replace_termcodes('<Ignore>', true, true, true) test_cursorhold(function() end, 1) test_cursorhold(function() feed('') end, 1) test_cursorhold(function() - meths.feedkeys('', 'n', true) + meths.nvim_feedkeys('', 'n', true) end, 1) test_cursorhold(function() feed('<Ignore>') end, 0) test_cursorhold(function() - meths.feedkeys(ignore_key, 'n', true) + meths.nvim_feedkeys(ignore_key, 'n', true) end, 0) end) it("reducing 'updatetime' while waiting for CursorHold #20241", function() - meths.set_option_value('updatetime', 10000, {}) + meths.nvim_set_option_value('updatetime', 10000, {}) feed('0') -- reset did_cursorhold - meths.set_var('cursorhold', 0) + meths.nvim_set_var('cursorhold', 0) sleep(50) - eq(0, meths.get_var('cursorhold')) - meths.set_option_value('updatetime', 20, {}) + eq(0, meths.nvim_get_var('cursorhold')) + meths.nvim_set_option_value('updatetime', 20, {}) sleep(10) - eq(1, meths.get_var('cursorhold')) + eq(1, meths.nvim_get_var('cursorhold')) end) end) @@ -85,7 +85,7 @@ describe('CursorHoldI', function() feed('ifoo') retry(5, nil, function() sleep(1) - eq(1, meths.get_var('cursorhold')) + eq(1, meths.nvim_get_var('cursorhold')) end) end) end) diff --git a/test/functional/autocmd/cursormoved_spec.lua b/test/functional/autocmd/cursormoved_spec.lua index 3ab5c3b9b1..0fa5ab296c 100644 --- a/test/functional/autocmd/cursormoved_spec.lua +++ b/test/functional/autocmd/cursormoved_spec.lua @@ -41,9 +41,9 @@ describe('CursorMoved', function() vsplit foo autocmd CursorMoved * let g:cursormoved += 1 ]]) - meths.buf_set_lines(eval('g:buf'), 0, -1, true, { 'aaa' }) + meths.nvim_buf_set_lines(eval('g:buf'), 0, -1, true, { 'aaa' }) eq(0, eval('g:cursormoved')) - eq({ 'aaa' }, meths.buf_get_lines(eval('g:buf'), 0, -1, true)) + eq({ 'aaa' }, meths.nvim_buf_get_lines(eval('g:buf'), 0, -1, true)) eq(0, eval('g:cursormoved')) end) diff --git a/test/functional/autocmd/safestate_spec.lua b/test/functional/autocmd/safestate_spec.lua index 73693749e4..867f845e48 100644 --- a/test/functional/autocmd/safestate_spec.lua +++ b/test/functional/autocmd/safestate_spec.lua @@ -18,40 +18,40 @@ describe('SafeState autocommand', function() it('with pending operator', function() feed('d') create_autocmd() - eq(0, meths.get_var('safe')) + eq(0, meths.nvim_get_var('safe')) feed('d') - eq(1, meths.get_var('safe')) + eq(1, meths.nvim_get_var('safe')) end) it('with specified register', function() feed('"r') create_autocmd() - eq(0, meths.get_var('safe')) + eq(0, meths.nvim_get_var('safe')) feed('x') - eq(1, meths.get_var('safe')) + eq(1, meths.nvim_get_var('safe')) end) it('with i_CTRL-O', function() feed('i<C-O>') create_autocmd() - eq(0, meths.get_var('safe')) + eq(0, meths.nvim_get_var('safe')) feed('x') - eq(1, meths.get_var('safe')) + eq(1, meths.nvim_get_var('safe')) end) it('with Insert mode completion', function() feed('i<C-X><C-V>') create_autocmd() - eq(0, meths.get_var('safe')) + eq(0, meths.nvim_get_var('safe')) feed('<C-X><C-Z>') - eq(1, meths.get_var('safe')) + eq(1, meths.nvim_get_var('safe')) end) it('with Cmdline completion', function() feed(':<Tab>') create_autocmd() - eq(0, meths.get_var('safe')) + eq(0, meths.nvim_get_var('safe')) feed('<C-E>') - eq(1, meths.get_var('safe')) + eq(1, meths.nvim_get_var('safe')) end) end) diff --git a/test/functional/autocmd/termxx_spec.lua b/test/functional/autocmd/termxx_spec.lua index dd79de4c37..caa7209de1 100644 --- a/test/functional/autocmd/termxx_spec.lua +++ b/test/functional/autocmd/termxx_spec.lua @@ -204,7 +204,7 @@ describe('autocmd TextChangedT', function() command('autocmd TextChangedT * ++once let g:called = 1') thelpers.feed_data('a') retry(nil, nil, function() - eq(1, meths.get_var('called')) + eq(1, meths.nvim_get_var('called')) end) end) @@ -212,6 +212,9 @@ describe('autocmd TextChangedT', function() command([[autocmd TextChangedT * call nvim_input('<CR>') | bwipe!]]) thelpers.feed_data('a') screen:expect({ any = 'E937: ' }) - matches('^E937: Attempt to delete a buffer that is in use: term://', meths.get_vvar('errmsg')) + matches( + '^E937: Attempt to delete a buffer that is in use: term://', + meths.nvim_get_vvar('errmsg') + ) end) end) diff --git a/test/functional/autocmd/win_scrolled_resized_spec.lua b/test/functional/autocmd/win_scrolled_resized_spec.lua index 6f61ad7902..67cb84de5b 100644 --- a/test/functional/autocmd/win_scrolled_resized_spec.lua +++ b/test/functional/autocmd/win_scrolled_resized_spec.lua @@ -45,7 +45,7 @@ describe('WinScrolled', function() local win_id before_each(function() - win_id = meths.get_current_win().id + win_id = meths.nvim_get_current_win().id command(string.format('autocmd WinScrolled %d let g:matched = v:true', win_id)) exec([[ let g:scrolled = 0 @@ -64,7 +64,7 @@ describe('WinScrolled', function() it('is triggered by scrolling vertically', function() local lines = { '123', '123' } - meths.buf_set_lines(0, 0, -1, true, lines) + meths.nvim_buf_set_lines(0, 0, -1, true, lines) eq(0, eval('g:scrolled')) feed('<C-E>') @@ -84,10 +84,10 @@ describe('WinScrolled', function() it('is triggered by scrolling horizontally', function() command('set nowrap') - local width = meths.win_get_width(0) + local width = meths.nvim_win_get_width(0) local line = '123' .. ('*'):rep(width * 2) local lines = { line, line } - meths.buf_set_lines(0, 0, -1, true, lines) + meths.nvim_buf_set_lines(0, 0, -1, true, lines) eq(0, eval('g:scrolled')) feed('zl') @@ -108,8 +108,8 @@ describe('WinScrolled', function() it('is triggered by horizontal scrolling from cursor move', function() command('set nowrap') local lines = { '', '', 'Foo' } - meths.buf_set_lines(0, 0, -1, true, lines) - meths.win_set_cursor(0, { 3, 0 }) + meths.nvim_buf_set_lines(0, 0, -1, true, lines) + meths.nvim_win_set_cursor(0, { 3, 0 }) eq(0, eval('g:scrolled')) feed('zl') @@ -143,10 +143,10 @@ describe('WinScrolled', function() -- oldtest: Test_WinScrolled_long_wrapped() it('is triggered by scrolling on a long wrapped line #19968', function() - local height = meths.win_get_height(0) - local width = meths.win_get_width(0) - meths.buf_set_lines(0, 0, -1, true, { ('foo'):rep(height * width) }) - meths.win_set_cursor(0, { 1, height * width - 1 }) + local height = meths.nvim_win_get_height(0) + local width = meths.nvim_win_get_width(0) + meths.nvim_buf_set_lines(0, 0, -1, true, { ('foo'):rep(height * width) }) + meths.nvim_win_set_cursor(0, { 1, height * width - 1 }) eq(0, eval('g:scrolled')) feed('gj') @@ -168,12 +168,12 @@ describe('WinScrolled', function() end) it('is triggered when the window scrolls in Insert mode', function() - local height = meths.win_get_height(0) + local height = meths.nvim_win_get_height(0) local lines = {} for i = 1, height * 2 do lines[i] = tostring(i) end - meths.buf_set_lines(0, 0, -1, true, lines) + meths.nvim_buf_set_lines(0, 0, -1, true, lines) feed('M') eq(0, eval('g:scrolled')) @@ -220,12 +220,12 @@ describe('WinScrolled', function() eq(0, eval('g:scrolled')) -- With the upper split focused, send a scroll-down event to the unfocused one. - meths.input_mouse('wheel', 'down', '', 0, 6, 0) + meths.nvim_input_mouse('wheel', 'down', '', 0, 6, 0) eq(1, eval('g:scrolled')) -- Again, but this time while we're in insert mode. feed('i') - meths.input_mouse('wheel', 'down', '', 0, 6, 0) + meths.nvim_input_mouse('wheel', 'down', '', 0, 6, 0) feed('<Esc>') eq(2, eval('g:scrolled')) end) @@ -296,15 +296,15 @@ describe('WinScrolled', function() ]]) eq(0, eval('g:scrolled')) - local buf = meths.create_buf(true, true) - meths.buf_set_lines( + local buf = meths.nvim_create_buf(true, true) + meths.nvim_buf_set_lines( buf, 0, -1, false, { '@', 'b', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n' } ) - local win = meths.open_win(buf, false, { + local win = meths.nvim_open_win(buf, false, { height = 5, width = 10, col = 0, @@ -317,7 +317,7 @@ describe('WinScrolled', function() -- WinScrolled should not be triggered when creating a new floating window eq(0, eval('g:scrolled')) - meths.input_mouse('wheel', 'down', '', 0, 3, 3) + meths.nvim_input_mouse('wheel', 'down', '', 0, 3, 3) eq(1, eval('g:scrolled')) eq(winid_str, eval('g:amatch')) eq({ @@ -325,7 +325,7 @@ describe('WinScrolled', function() [winid_str] = { leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0 }, }, eval('g:v_event')) - meths.input_mouse('wheel', 'up', '', 0, 3, 3) + meths.nvim_input_mouse('wheel', 'up', '', 0, 3, 3) eq(2, eval('g:scrolled')) eq(tostring(win.id), eval('g:amatch')) eq({ |