diff options
Diffstat (limited to 'test/functional/ex_cmds')
-rw-r--r-- | test/functional/ex_cmds/append_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/ex_cmds/dict_notifications_spec.lua | 25 | ||||
-rw-r--r-- | test/functional/ex_cmds/ls_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ex_cmds/make_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/ex_cmds/menu_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/ex_cmds/oldfiles_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/ex_cmds/quickfix_commands_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ex_cmds/sign_spec.lua | 24 |
8 files changed, 49 insertions, 47 deletions
diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua index 4bd323a763..27e56de54e 100644 --- a/test/functional/ex_cmds/append_spec.lua +++ b/test/functional/ex_cmds/append_spec.lua @@ -7,7 +7,6 @@ local feed = helpers.feed local clear = helpers.clear local funcs = helpers.funcs local command = helpers.command -local curbufmeths = helpers.curbufmeths local meths = helpers.meths local Screen = require('test.functional.ui.screen') @@ -15,11 +14,11 @@ local cmdtest = function(cmd, prep, ret1) describe(':' .. cmd, function() before_each(function() clear() - curbufmeths.set_lines(0, 1, true, { 'foo', 'bar', 'baz' }) + meths.nvim_buf_set_lines(0, 0, 1, true, { 'foo', 'bar', 'baz' }) end) local buffer_contents = function() - return curbufmeths.get_lines(0, -1, false) + return meths.nvim_buf_get_lines(0, 0, -1, false) end it(cmd .. 's' .. prep .. ' the current line by default', function() diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua index 821c8cf593..439d28d59a 100644 --- a/test/functional/ex_cmds/dict_notifications_spec.lua +++ b/test/functional/ex_cmds/dict_notifications_spec.lua @@ -1,6 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local assert_alive = helpers.assert_alive -local clear, nvim, source = helpers.clear, helpers.nvim, helpers.source +local clear, source = helpers.clear, helpers.source +local meths = helpers.meths local insert = helpers.insert local eq, next_msg = helpers.eq, helpers.next_msg local exc_exec = helpers.exc_exec @@ -13,8 +14,8 @@ describe('Vimscript dictionary notifications', function() before_each(function() clear() - channel = nvim('get_api_info')[1] - nvim('set_var', 'channel', channel) + channel = meths.nvim_get_api_info()[1] + meths.nvim_set_var('channel', channel) end) -- the same set of tests are applied to top-level dictionaries(g:, b:, w: and @@ -59,7 +60,7 @@ describe('Vimscript dictionary notifications', function() local function verify_echo() -- helper to verify that no notifications are sent after certain change -- to a dict - nvim('command', "call rpcnotify(g:channel, 'echo')") + command("call rpcnotify(g:channel, 'echo')") eq({ 'notification', 'echo', {} }, next_msg()) end @@ -134,7 +135,7 @@ describe('Vimscript dictionary notifications', function() it('is triggered by remove()', function() update('= "test"') verify_value({ new = 'test' }) - nvim('command', 'call remove(' .. dict_expr .. ', "watched")') + command('call remove(' .. dict_expr .. ', "watched")') verify_value({ old = 'test' }) end) @@ -142,14 +143,14 @@ describe('Vimscript dictionary notifications', function() it('is triggered by remove() when updated with nvim_*_var', function() update_with_api('"test"') verify_value({ new = 'test' }) - nvim('command', 'call remove(' .. dict_expr .. ', "watched")') + command('call remove(' .. dict_expr .. ', "watched")') verify_value({ old = 'test' }) end) it('is triggered by remove() when updated with vim.g', function() update_with_vim_g('= "test"') verify_value({ new = 'test' }) - nvim('command', 'call remove(' .. dict_expr .. ', "watched")') + command('call remove(' .. dict_expr .. ', "watched")') verify_value({ old = 'test' }) end) end @@ -157,7 +158,7 @@ describe('Vimscript dictionary notifications', function() it('is triggered by extend()', function() update('= "xtend"') verify_value({ new = 'xtend' }) - nvim('command', [[ + command([[ call extend(]] .. dict_expr .. [[, {'watched': 'xtend2', 'watched2': 5, 'watched3': 'a'}) ]]) verify_value({ old = 'xtend', new = 'xtend2' }) @@ -293,17 +294,17 @@ describe('Vimscript dictionary notifications', function() end) it('invokes all callbacks when the key is changed', function() - nvim('command', 'let g:key = "value"') + command('let g:key = "value"') eq({ 'notification', '1', { 'key', { new = 'value' } } }, next_msg()) eq({ 'notification', '2', { 'key', { new = 'value' } } }, next_msg()) end) it('only removes watchers that fully match dict, key and callback', function() - nvim('command', 'let g:key = "value"') + command('let g:key = "value"') eq({ 'notification', '1', { 'key', { new = 'value' } } }, next_msg()) eq({ 'notification', '2', { 'key', { new = 'value' } } }, next_msg()) - nvim('command', 'call dictwatcherdel(g:, "key", "g:Watcher1")') - nvim('command', 'let g:key = "v2"') + command('call dictwatcherdel(g:, "key", "g:Watcher1")') + command('let g:key = "v2"') eq({ 'notification', '2', { 'key', { old = 'value', new = 'v2' } } }, next_msg()) end) end) diff --git a/test/functional/ex_cmds/ls_spec.lua b/test/functional/ex_cmds/ls_spec.lua index a2a95fbf3f..0dac810ef7 100644 --- a/test/functional/ex_cmds/ls_spec.lua +++ b/test/functional/ex_cmds/ls_spec.lua @@ -4,7 +4,7 @@ local command = helpers.command local eq = helpers.eq local eval = helpers.eval local feed = helpers.feed -local nvim = helpers.nvim +local meths = helpers.meths local testprg = helpers.testprg local retry = helpers.retry @@ -14,7 +14,7 @@ describe(':ls', function() end) it('R, F for :terminal buffers', function() - nvim('set_option_value', 'shell', string.format('"%s" INTERACT', testprg('shell-test')), {}) + meths.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {}) command('edit foo') command('set hidden') diff --git a/test/functional/ex_cmds/make_spec.lua b/test/functional/ex_cmds/make_spec.lua index 88fd0e14e1..a91ee23bb8 100644 --- a/test/functional/ex_cmds/make_spec.lua +++ b/test/functional/ex_cmds/make_spec.lua @@ -3,7 +3,7 @@ local clear = helpers.clear local eval = helpers.eval local has_powershell = helpers.has_powershell local matches = helpers.matches -local nvim = helpers.nvim +local meths = helpers.meths local testprg = helpers.testprg describe(':make', function() @@ -22,7 +22,7 @@ describe(':make', function() end) it('captures stderr & non zero exit code #14349', function() - nvim('set_option_value', 'makeprg', testprg('shell-test') .. ' foo', {}) + meths.nvim_set_option_value('makeprg', testprg('shell-test') .. ' foo', {}) local out = eval('execute("make")') -- Error message is captured in the file and printed in the footer matches( @@ -32,7 +32,7 @@ describe(':make', function() end) it('captures stderr & zero exit code #14349', function() - nvim('set_option_value', 'makeprg', testprg('shell-test'), {}) + meths.nvim_set_option_value('makeprg', testprg('shell-test'), {}) local out = eval('execute("make")') -- Ensure there are no "shell returned X" messages between -- command and last line (indicating zero exit) diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua index d6d8cce161..cd5f4d870c 100644 --- a/test/functional/ex_cmds/menu_spec.lua +++ b/test/functional/ex_cmds/menu_spec.lua @@ -1,5 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) -local clear, command, nvim = helpers.clear, helpers.command, helpers.nvim +local clear, command = helpers.clear, helpers.command local expect, feed = helpers.expect, helpers.feed local eq, eval = helpers.eq, helpers.eval local funcs = helpers.funcs @@ -42,12 +42,12 @@ describe(':emenu', function() feed('ithis is a sentence<esc>^yiwo<esc>') -- Invoke "Edit.Paste" in normal-mode. - nvim('command', 'emenu Edit.Paste') + command('emenu Edit.Paste') -- Invoke "Edit.Paste" and "Test.Test" in command-mode. feed(':') - nvim('command', 'emenu Edit.Paste') - nvim('command', 'emenu Test.Test') + command('emenu Edit.Paste') + command('emenu Test.Test') expect([[ this is a sentence diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua index 8330395ed1..ee2bbdc4e7 100644 --- a/test/functional/ex_cmds/oldfiles_spec.lua +++ b/test/functional/ex_cmds/oldfiles_spec.lua @@ -4,7 +4,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local command = helpers.command local expect_exit = helpers.expect_exit -local buf, eq, feed_command = helpers.curbufmeths, helpers.eq, helpers.feed_command +local meths, eq, feed_command = helpers.meths, helpers.eq, helpers.feed_command local feed, poke_eventloop = helpers.feed, helpers.poke_eventloop local ok = helpers.ok local eval = helpers.eval @@ -42,7 +42,7 @@ describe(':oldfiles', function() feed_command('edit testfile2') feed_command('wshada') feed_command('rshada!') - local oldfiles = helpers.meths.nvim_get_vvar('oldfiles') + local oldfiles = meths.nvim_get_vvar('oldfiles') feed_command('oldfiles') screen:expect([[ | @@ -56,11 +56,11 @@ describe(':oldfiles', function() it('can be filtered with :filter', function() feed_command('edit file_one.txt') - local file1 = buf.get_name() + local file1 = meths.nvim_buf_get_name(0) feed_command('edit file_two.txt') - local file2 = buf.get_name() + local file2 = meths.nvim_buf_get_name(0) feed_command('edit another.txt') - local another = buf.get_name() + local another = meths.nvim_buf_get_name(0) feed_command('wshada') feed_command('rshada!') @@ -95,9 +95,9 @@ describe(':browse oldfiles', function() before_each(function() _clear() feed_command('edit testfile1') - filename = buf.get_name() + filename = meths.nvim_buf_get_name(0) feed_command('edit testfile2') - filename2 = buf.get_name() + filename2 = meths.nvim_buf_get_name(0) feed_command('wshada') poke_eventloop() _clear() @@ -123,16 +123,16 @@ describe(':browse oldfiles', function() it('provides a prompt and edits the chosen file', function() feed('2<cr>') - eq(oldfiles[2], buf.get_name()) + eq(oldfiles[2], meths.nvim_buf_get_name(0)) end) it('provides a prompt and does nothing on <cr>', function() feed('<cr>') - eq('', buf.get_name()) + eq('', meths.nvim_buf_get_name(0)) end) it('provides a prompt and does nothing if choice is out-of-bounds', function() feed('3<cr>') - eq('', buf.get_name()) + eq('', meths.nvim_buf_get_name(0)) end) end) diff --git a/test/functional/ex_cmds/quickfix_commands_spec.lua b/test/functional/ex_cmds/quickfix_commands_spec.lua index e694f5d1da..74283fcb4e 100644 --- a/test/functional/ex_cmds/quickfix_commands_spec.lua +++ b/test/functional/ex_cmds/quickfix_commands_spec.lua @@ -8,7 +8,7 @@ local funcs = helpers.funcs local command = helpers.command local exc_exec = helpers.exc_exec local write_file = helpers.write_file -local curbufmeths = helpers.curbufmeths +local meths = helpers.meths local source = helpers.source local file_base = 'Xtest-functional-ex_cmds-quickfix_commands' @@ -79,7 +79,7 @@ for _, c in ipairs({ 'l', 'c' }) do -- Run cfile/lfile from a modified buffer command('set nohidden') command('enew!') - curbufmeths.set_lines(1, 1, true, { 'Quickfix' }) + meths.nvim_buf_set_lines(0, 1, 1, true, { 'Quickfix' }) eq( ('Vim(%s):E37: No write since last change (add ! to override)'):format(filecmd), exc_exec(('%s %s'):format(filecmd, file)) diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua index 30c6f9ac47..a0783264a7 100644 --- a/test/functional/ex_cmds/sign_spec.lua +++ b/test/functional/ex_cmds/sign_spec.lua @@ -1,5 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) -local clear, nvim, eq, assert_alive = helpers.clear, helpers.nvim, helpers.eq, helpers.assert_alive +local clear, eq, assert_alive = helpers.clear, helpers.eq, helpers.assert_alive +local command = helpers.command +local meths = helpers.meths describe('sign', function() before_each(clear) @@ -7,24 +9,24 @@ describe('sign', function() describe('without specifying buffer', function() it('deletes the sign from all buffers', function() -- place a sign with id 34 to first buffer - nvim('command', 'sign define Foo text=+ texthl=Delimiter linehl=Comment numhl=Number') - local buf1 = nvim('eval', 'bufnr("%")') - nvim('command', 'sign place 34 line=3 name=Foo buffer=' .. buf1) + command('sign define Foo text=+ texthl=Delimiter linehl=Comment numhl=Number') + local buf1 = meths.nvim_eval('bufnr("%")') + command('sign place 34 line=3 name=Foo buffer=' .. buf1) -- create a second buffer and place the sign on it as well - nvim('command', 'new') - local buf2 = nvim('eval', 'bufnr("%")') - nvim('command', 'sign place 34 line=3 name=Foo buffer=' .. buf2) + command('new') + local buf2 = meths.nvim_eval('bufnr("%")') + 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('exec', 'sign place buffer=' .. buf1, true)) - eq('--- Signs ---\n', nvim('exec', 'sign place buffer=' .. buf2, true)) + command('sign unplace 34') + eq('--- Signs ---\n', meths.nvim_exec('sign place buffer=' .. buf1, true)) + eq('--- Signs ---\n', meths.nvim_exec('sign place buffer=' .. buf2, true)) end) end) end) describe('define {id}', function() it('does not leak memory when specifying multiple times the same argument', function() - nvim('command', 'sign define Foo culhl=Normal culhl=Normal') + command('sign define Foo culhl=Normal culhl=Normal') assert_alive() end) end) |