mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test: normalise nvim bridge functions
- remove helpers.cur*meths - remove helpers.nvim
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local neq, eq, command = helpers.neq, helpers.eq, helpers.command
|
||||
local clear, curbufmeths = helpers.clear, helpers.curbufmeths
|
||||
local clear = helpers.clear
|
||||
local exc_exec, expect, eval = helpers.exc_exec, helpers.expect, helpers.eval
|
||||
local insert, pcall_err = helpers.insert, helpers.pcall_err
|
||||
local matches = helpers.matches
|
||||
@@ -97,8 +97,8 @@ describe('eval-API', function()
|
||||
)
|
||||
|
||||
-- But others, like nvim_buf_set_lines(), which just changes text, is OK.
|
||||
curbufmeths.set_lines(0, -1, 1, { 'wow!' })
|
||||
eq({ 'wow!' }, curbufmeths.get_lines(0, -1, 1))
|
||||
meths.nvim_buf_set_lines(0, 0, -1, 1, { 'wow!' })
|
||||
eq({ 'wow!' }, meths.nvim_buf_get_lines(0, 0, -1, 1))
|
||||
|
||||
-- Turning the cmdwin buffer into a terminal buffer would be pretty weird.
|
||||
eq(
|
||||
@@ -143,11 +143,11 @@ describe('eval-API', function()
|
||||
end)
|
||||
|
||||
it('get_lines and set_lines use NL to represent NUL', function()
|
||||
curbufmeths.set_lines(0, -1, true, { 'aa\0', 'b\0b' })
|
||||
meths.nvim_buf_set_lines(0, 0, -1, true, { 'aa\0', 'b\0b' })
|
||||
eq({ 'aa\n', 'b\nb' }, eval('nvim_buf_get_lines(0, 0, -1, 1)'))
|
||||
|
||||
command('call nvim_buf_set_lines(0, 1, 2, v:true, ["xx", "\\nyy"])')
|
||||
eq({ 'aa\0', 'xx', '\0yy' }, curbufmeths.get_lines(0, -1, 1))
|
||||
eq({ 'aa\0', 'xx', '\0yy' }, meths.nvim_buf_get_lines(0, 0, -1, 1))
|
||||
end)
|
||||
|
||||
it('that are FUNC_ATTR_NOEVAL cannot be called', function()
|
||||
|
||||
@@ -6,10 +6,6 @@ local funcs = helpers.funcs
|
||||
local meths = helpers.meths
|
||||
local command = helpers.command
|
||||
local exc_exec = helpers.exc_exec
|
||||
local bufmeths = helpers.bufmeths
|
||||
local curbufmeths = helpers.curbufmeths
|
||||
local curwinmeths = helpers.curwinmeths
|
||||
local curtabmeths = helpers.curtabmeths
|
||||
local get_pathsep = helpers.get_pathsep
|
||||
local rmdir = helpers.rmdir
|
||||
local pcall_err = helpers.pcall_err
|
||||
@@ -196,7 +192,7 @@ describe('getbufline() function', function()
|
||||
end)
|
||||
it('returns empty list when range is invalid', function()
|
||||
eq({}, funcs.getbufline(1, 0))
|
||||
curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'baz' })
|
||||
meths.nvim_buf_set_lines(0, 0, 1, false, { 'foo', 'bar', 'baz' })
|
||||
eq({}, funcs.getbufline(1, 2, 1))
|
||||
eq({}, funcs.getbufline(1, -10, -20))
|
||||
eq({}, funcs.getbufline(1, -2, -1))
|
||||
@@ -205,9 +201,9 @@ describe('getbufline() function', function()
|
||||
it('returns expected lines', function()
|
||||
meths.nvim_set_option_value('hidden', true, {})
|
||||
command('file ' .. fname)
|
||||
curbufmeths.set_lines(0, 1, false, { 'foo\0', '\0bar', 'baz' })
|
||||
meths.nvim_buf_set_lines(0, 0, 1, false, { 'foo\0', '\0bar', 'baz' })
|
||||
command('edit ' .. fname2)
|
||||
curbufmeths.set_lines(0, 1, false, { 'abc\0', '\0def', 'ghi' })
|
||||
meths.nvim_buf_set_lines(0, 0, 1, false, { 'abc\0', '\0def', 'ghi' })
|
||||
eq({ 'foo\n', '\nbar', 'baz' }, funcs.getbufline(1, 1, 9999))
|
||||
eq({ 'abc\n', '\ndef', 'ghi' }, funcs.getbufline(2, 1, 9999))
|
||||
eq({ 'foo\n', '\nbar', 'baz' }, funcs.getbufline(1, 1, '$'))
|
||||
@@ -247,7 +243,7 @@ describe('getbufvar() function', function()
|
||||
-- But with window-local options it probably does not what you expect
|
||||
command('setl number')
|
||||
-- (note that current window’s buffer is 2, but getbufvar() receives 1)
|
||||
eq({ id = 2 }, curwinmeths.get_buf())
|
||||
eq({ id = 2 }, meths.nvim_win_get_buf(0))
|
||||
eq(1, funcs.getbufvar(1, '&number'))
|
||||
eq(1, funcs.getbufvar(1, '&l:number'))
|
||||
-- You can get global value though, if you find this useful.
|
||||
@@ -255,9 +251,9 @@ describe('getbufvar() function', function()
|
||||
end)
|
||||
it('returns expected variable value', function()
|
||||
eq(2, funcs.getbufvar(1, 'changedtick'))
|
||||
curbufmeths.set_lines(0, 1, false, { 'abc\0', '\0def', 'ghi' })
|
||||
meths.nvim_buf_set_lines(0, 0, 1, false, { 'abc\0', '\0def', 'ghi' })
|
||||
eq(3, funcs.getbufvar(1, 'changedtick'))
|
||||
curbufmeths.set_var('test', true)
|
||||
meths.nvim_buf_set_var(0, 'test', true)
|
||||
eq(true, funcs.getbufvar(1, 'test'))
|
||||
eq({ test = true, changedtick = 3 }, funcs.getbufvar(1, ''))
|
||||
command('new')
|
||||
@@ -288,9 +284,9 @@ describe('setbufvar() function', function()
|
||||
eq(false, meths.nvim_get_option_value('number', {}))
|
||||
command('split')
|
||||
command('new')
|
||||
eq(2, bufmeths.get_number(curwinmeths.get_buf()))
|
||||
eq(2, meths.nvim_buf_get_number(meths.nvim_win_get_buf(0)))
|
||||
funcs.setbufvar(1, '&number', true)
|
||||
local windows = curtabmeths.list_wins()
|
||||
local windows = meths.nvim_tabpage_list_wins(0)
|
||||
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 }))
|
||||
@@ -309,11 +305,11 @@ describe('setbufvar() function', function()
|
||||
local buf1 = meths.nvim_get_current_buf()
|
||||
command('split')
|
||||
command('new')
|
||||
eq(2, curbufmeths.get_number())
|
||||
eq(2, meths.nvim_buf_get_number(0))
|
||||
funcs.setbufvar(1, 'number', true)
|
||||
eq(true, bufmeths.get_var(buf1, 'number'))
|
||||
eq(true, meths.nvim_buf_get_var(buf1, 'number'))
|
||||
eq('Vim(call):E461: Illegal variable name: b:', exc_exec('call setbufvar(1, "", 0)'))
|
||||
eq(true, bufmeths.get_var(buf1, 'number'))
|
||||
eq(true, meths.nvim_buf_get_var(buf1, 'number'))
|
||||
eq(
|
||||
'Vim:E46: Cannot change read-only variable "b:changedtick"',
|
||||
pcall_err(funcs.setbufvar, 1, 'changedtick', true)
|
||||
|
||||
@@ -10,14 +10,13 @@ local command = helpers.command
|
||||
local exc_exec = helpers.exc_exec
|
||||
local pcall_err = helpers.pcall_err
|
||||
local exec_capture = helpers.exec_capture
|
||||
local curbufmeths = helpers.curbufmeths
|
||||
|
||||
before_each(clear)
|
||||
|
||||
local function changedtick()
|
||||
local ct = curbufmeths.get_changedtick()
|
||||
eq(ct, curbufmeths.get_var('changedtick'))
|
||||
eq(ct, curbufmeths.get_var('changedtick'))
|
||||
local ct = meths.nvim_buf_get_changedtick(0)
|
||||
eq(ct, meths.nvim_buf_get_var(0, 'changedtick'))
|
||||
eq(ct, meths.nvim_buf_get_var(0, 'changedtick'))
|
||||
eq(ct, eval('b:changedtick'))
|
||||
eq(ct, eval('b:["changedtick"]'))
|
||||
eq(ct, eval('b:.changedtick'))
|
||||
@@ -46,11 +45,11 @@ describe('b:changedtick', function()
|
||||
it('increments at bdel', function()
|
||||
command('new')
|
||||
eq(2, changedtick())
|
||||
local bnr = curbufmeths.get_number()
|
||||
local bnr = meths.nvim_buf_get_number(0)
|
||||
eq(2, bnr)
|
||||
command('bdel')
|
||||
eq(3, funcs.getbufvar(bnr, 'changedtick'))
|
||||
eq(1, curbufmeths.get_number())
|
||||
eq(1, meths.nvim_buf_get_number(0))
|
||||
end)
|
||||
it('fails to be changed by user', function()
|
||||
local ct = changedtick()
|
||||
@@ -72,7 +71,7 @@ describe('b:changedtick', function()
|
||||
'Vim(let):E46: Cannot change read-only variable "d.changedtick"',
|
||||
pcall_err(command, 'let d.changedtick = ' .. ctn)
|
||||
)
|
||||
eq('Key is read-only: changedtick', pcall_err(curbufmeths.set_var, 'changedtick', ctn))
|
||||
eq('Key is read-only: changedtick', pcall_err(meths.nvim_buf_set_var, 0, 'changedtick', ctn))
|
||||
|
||||
eq(
|
||||
'Vim(unlet):E795: Cannot delete variable b:changedtick',
|
||||
@@ -90,7 +89,7 @@ describe('b:changedtick', function()
|
||||
'Vim(unlet):E46: Cannot change read-only variable "d.changedtick"',
|
||||
pcall_err(command, 'unlet d.changedtick')
|
||||
)
|
||||
eq('Key is read-only: changedtick', pcall_err(curbufmeths.del_var, 'changedtick'))
|
||||
eq('Key is read-only: changedtick', pcall_err(meths.nvim_buf_del_var, 0, 'changedtick'))
|
||||
eq(ct, changedtick())
|
||||
|
||||
eq(
|
||||
|
||||
@@ -7,7 +7,7 @@ local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local feed = helpers.feed
|
||||
local map = vim.tbl_map
|
||||
local nvim = helpers.nvim
|
||||
local meths = helpers.meths
|
||||
local parse_context = helpers.parse_context
|
||||
local exec_capture = helpers.exec_capture
|
||||
local source = helpers.source
|
||||
@@ -126,16 +126,16 @@ describe('context functions', function()
|
||||
end)
|
||||
|
||||
it('saves and restores global variables properly', function()
|
||||
nvim('set_var', 'one', 1)
|
||||
nvim('set_var', 'Two', 2)
|
||||
nvim('set_var', 'THREE', 3)
|
||||
meths.nvim_set_var('one', 1)
|
||||
meths.nvim_set_var('Two', 2)
|
||||
meths.nvim_set_var('THREE', 3)
|
||||
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
|
||||
call('ctxpush')
|
||||
call('ctxpush', { 'gvars' })
|
||||
|
||||
nvim('del_var', 'one')
|
||||
nvim('del_var', 'Two')
|
||||
nvim('del_var', 'THREE')
|
||||
meths.nvim_del_var('one')
|
||||
meths.nvim_del_var('Two')
|
||||
meths.nvim_del_var('THREE')
|
||||
eq('Vim:E121: Undefined variable: g:one', pcall_err(eval, 'g:one'))
|
||||
eq('Vim:E121: Undefined variable: g:Two', pcall_err(eval, 'g:Two'))
|
||||
eq('Vim:E121: Undefined variable: g:THREE', pcall_err(eval, 'g:THREE'))
|
||||
@@ -143,9 +143,9 @@ describe('context functions', function()
|
||||
call('ctxpop')
|
||||
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
|
||||
|
||||
nvim('del_var', 'one')
|
||||
nvim('del_var', 'Two')
|
||||
nvim('del_var', 'THREE')
|
||||
meths.nvim_del_var('one')
|
||||
meths.nvim_del_var('Two')
|
||||
meths.nvim_del_var('THREE')
|
||||
eq('Vim:E121: Undefined variable: g:one', pcall_err(eval, 'g:one'))
|
||||
eq('Vim:E121: Undefined variable: g:Two', pcall_err(eval, 'g:Two'))
|
||||
eq('Vim:E121: Undefined variable: g:THREE', pcall_err(eval, 'g:THREE'))
|
||||
@@ -300,9 +300,9 @@ describe('context functions', function()
|
||||
feed('G')
|
||||
feed('gg')
|
||||
command('edit ' .. fname2)
|
||||
nvim('set_var', 'one', 1)
|
||||
nvim('set_var', 'Two', 2)
|
||||
nvim('set_var', 'THREE', 3)
|
||||
meths.nvim_set_var('one', 1)
|
||||
meths.nvim_set_var('Two', 2)
|
||||
meths.nvim_set_var('THREE', 3)
|
||||
|
||||
local with_regs = {
|
||||
['regs'] = {
|
||||
@@ -412,14 +412,14 @@ describe('context functions', function()
|
||||
end)
|
||||
|
||||
it('sets context dictionary at index in context stack', function()
|
||||
nvim('set_var', 'one', 1)
|
||||
nvim('set_var', 'Two', 2)
|
||||
nvim('set_var', 'THREE', 3)
|
||||
meths.nvim_set_var('one', 1)
|
||||
meths.nvim_set_var('Two', 2)
|
||||
meths.nvim_set_var('THREE', 3)
|
||||
call('ctxpush')
|
||||
local ctx1 = call('ctxget')
|
||||
nvim('set_var', 'one', 'a')
|
||||
nvim('set_var', 'Two', 'b')
|
||||
nvim('set_var', 'THREE', 'c')
|
||||
meths.nvim_set_var('one', 'a')
|
||||
meths.nvim_set_var('Two', 'b')
|
||||
meths.nvim_set_var('THREE', 'c')
|
||||
call('ctxpush')
|
||||
call('ctxpush')
|
||||
local ctx2 = call('ctxget')
|
||||
@@ -431,7 +431,7 @@ describe('context functions', function()
|
||||
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
|
||||
call('ctxpop')
|
||||
eq({ 'a', 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))
|
||||
nvim('set_var', 'one', 1.5)
|
||||
meths.nvim_set_var('one', 1.5)
|
||||
eq({ 1.5, 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))
|
||||
call('ctxpop')
|
||||
eq({ 'a', 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))
|
||||
|
||||
@@ -4,7 +4,7 @@ local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local exc_exec = helpers.exc_exec
|
||||
local get_cur_win_var = helpers.curwinmeths.get_var
|
||||
local get_win_var = helpers.meths.nvim_win_get_var
|
||||
|
||||
describe('setqflist()', function()
|
||||
local setqflist = helpers.funcs.setqflist
|
||||
@@ -26,15 +26,15 @@ describe('setqflist()', function()
|
||||
it('sets w:quickfix_title', function()
|
||||
setqflist({ '' }, 'r', 'foo')
|
||||
command('copen')
|
||||
eq('foo', get_cur_win_var('quickfix_title'))
|
||||
eq('foo', get_win_var(0, 'quickfix_title'))
|
||||
setqflist({}, 'r', { ['title'] = 'qf_title' })
|
||||
eq('qf_title', get_cur_win_var('quickfix_title'))
|
||||
eq('qf_title', get_win_var(0, 'quickfix_title'))
|
||||
end)
|
||||
|
||||
it('allows string {what} for backwards compatibility', function()
|
||||
setqflist({}, 'r', '5')
|
||||
command('copen')
|
||||
eq('5', get_cur_win_var('quickfix_title'))
|
||||
eq('5', get_win_var(0, 'quickfix_title'))
|
||||
end)
|
||||
|
||||
it('requires a dict for {what}', function()
|
||||
@@ -67,9 +67,9 @@ describe('setloclist()', function()
|
||||
setloclist(1, {}, 'r', 'foo')
|
||||
setloclist(2, {}, 'r', 'bar')
|
||||
command('lopen')
|
||||
eq('bar', get_cur_win_var('quickfix_title'))
|
||||
eq('bar', get_win_var(0, 'quickfix_title'))
|
||||
command('lclose | wincmd w | lopen')
|
||||
eq('foo', get_cur_win_var('quickfix_title'))
|
||||
eq('foo', get_win_var(0, 'quickfix_title'))
|
||||
end)
|
||||
|
||||
it("doesn't crash when when window is closed in the middle #13721", function()
|
||||
|
||||
@@ -9,7 +9,6 @@ local expect = helpers.expect
|
||||
local feed = helpers.feed
|
||||
local funcs = helpers.funcs
|
||||
local meths = helpers.meths
|
||||
local nvim = helpers.nvim
|
||||
local source = helpers.source
|
||||
local command = helpers.command
|
||||
local exec_capture = helpers.exec_capture
|
||||
@@ -37,16 +36,16 @@ describe('maparg()', function()
|
||||
}
|
||||
|
||||
it('returns a dictionary', function()
|
||||
nvim('command', 'nnoremap foo bar')
|
||||
command('nnoremap foo bar')
|
||||
eq('bar', funcs.maparg('foo'))
|
||||
eq(foo_bar_map_table, funcs.maparg('foo', 'n', false, true))
|
||||
end)
|
||||
|
||||
it('returns 1 for silent when <silent> is used', function()
|
||||
nvim('command', 'nnoremap <silent> foo bar')
|
||||
command('nnoremap <silent> foo bar')
|
||||
eq(1, funcs.maparg('foo', 'n', false, true)['silent'])
|
||||
|
||||
nvim('command', 'nnoremap baz bat')
|
||||
command('nnoremap baz bat')
|
||||
eq(0, funcs.maparg('baz', 'n', false, true)['silent'])
|
||||
end)
|
||||
|
||||
@@ -59,8 +58,8 @@ describe('maparg()', function()
|
||||
end)
|
||||
|
||||
it('returns the same value for noremap and <script>', function()
|
||||
nvim('command', 'inoremap <script> hello world')
|
||||
nvim('command', 'inoremap this that')
|
||||
command('inoremap <script> hello world')
|
||||
command('inoremap this that')
|
||||
eq(
|
||||
funcs.maparg('hello', 'i', false, true)['noremap'],
|
||||
funcs.maparg('this', 'i', false, true)['noremap']
|
||||
@@ -69,14 +68,14 @@ describe('maparg()', function()
|
||||
|
||||
it('returns a boolean for buffer', function()
|
||||
-- Open enough windows to know we aren't on buffer number 1
|
||||
nvim('command', 'new')
|
||||
nvim('command', 'new')
|
||||
nvim('command', 'new')
|
||||
nvim('command', 'cnoremap <buffer> this that')
|
||||
command('new')
|
||||
command('new')
|
||||
command('new')
|
||||
command('cnoremap <buffer> this that')
|
||||
eq(1, funcs.maparg('this', 'c', false, true)['buffer'])
|
||||
|
||||
-- Global will return 0 always
|
||||
nvim('command', 'nnoremap other another')
|
||||
command('nnoremap other another')
|
||||
eq(0, funcs.maparg('other', 'n', false, true)['buffer'])
|
||||
end)
|
||||
|
||||
@@ -89,7 +88,7 @@ describe('maparg()', function()
|
||||
nnoremap fizz :call <SID>maparg_test_function()<CR>
|
||||
]])
|
||||
eq(1, funcs.maparg('fizz', 'n', false, true)['sid'])
|
||||
eq('testing', nvim('call_function', '<SNR>1_maparg_test_function', {}))
|
||||
eq('testing', meths.nvim_call_function('<SNR>1_maparg_test_function', {}))
|
||||
end)
|
||||
|
||||
it('works with <F12> and others', function()
|
||||
|
||||
@@ -3,7 +3,7 @@ local clear = helpers.clear
|
||||
local funcs = helpers.funcs
|
||||
local eval, eq = helpers.eval, helpers.eq
|
||||
local command = helpers.command
|
||||
local nvim = helpers.nvim
|
||||
local meths = helpers.meths
|
||||
local exc_exec = helpers.exc_exec
|
||||
local is_os = helpers.is_os
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('msgpack*() functions', function()
|
||||
|
||||
local obj_test = function(msg, obj)
|
||||
it(msg, function()
|
||||
nvim('set_var', 'obj', obj)
|
||||
meths.nvim_set_var('obj', obj)
|
||||
eq(obj, eval('msgpackparse(msgpackdump(g:obj))'))
|
||||
eq(obj, eval('msgpackparse(msgpackdump(g:obj, "B"))'))
|
||||
end)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
|
||||
local curbufmeths = helpers.curbufmeths
|
||||
local exc_exec = helpers.exc_exec
|
||||
local command = helpers.command
|
||||
local clear = helpers.clear
|
||||
@@ -72,10 +71,10 @@ describe('NULL', function()
|
||||
null_expr_test('is not locked', 'islocked("v:_null_list")', 0, 0)
|
||||
null_test('is accepted by :for', 'for x in L|throw x|endfor', 0)
|
||||
null_expr_test('does not crash append()', 'append(0, L)', 0, 0, function()
|
||||
eq({ '' }, curbufmeths.get_lines(0, -1, false))
|
||||
eq({ '' }, meths.nvim_buf_get_lines(0, 0, -1, false))
|
||||
end)
|
||||
null_expr_test('does not crash setline()', 'setline(1, L)', 0, 0, function()
|
||||
eq({ '' }, curbufmeths.get_lines(0, -1, false))
|
||||
eq({ '' }, meths.nvim_buf_get_lines(0, 0, -1, false))
|
||||
end)
|
||||
null_expr_test('is identical to itself', 'L is L', 0, 1)
|
||||
null_expr_test('can be sliced', 'L[:]', 0, {})
|
||||
@@ -184,7 +183,7 @@ describe('NULL', function()
|
||||
0,
|
||||
'',
|
||||
function()
|
||||
eq({ '' }, curbufmeths.get_lines(0, -1, false))
|
||||
eq({ '' }, meths.nvim_buf_get_lines(0, 0, -1, false))
|
||||
end
|
||||
)
|
||||
null_expr_test('is accepted by setmatches()', 'setmatches(L)', 0, 0)
|
||||
|
||||
@@ -4,14 +4,14 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
|
||||
local assert_alive = helpers.assert_alive
|
||||
local testprg = helpers.testprg
|
||||
local eq, call, clear, eval, feed_command, feed, nvim =
|
||||
local eq, call, clear, eval, feed_command, feed, meths =
|
||||
helpers.eq,
|
||||
helpers.call,
|
||||
helpers.clear,
|
||||
helpers.eval,
|
||||
helpers.feed_command,
|
||||
helpers.feed,
|
||||
helpers.nvim
|
||||
helpers.meths
|
||||
local command = helpers.command
|
||||
local insert = helpers.insert
|
||||
local expect = helpers.expect
|
||||
@@ -220,8 +220,8 @@ describe('system()', function()
|
||||
end)
|
||||
|
||||
it('prints verbose information', function()
|
||||
nvim('set_option_value', 'shell', 'fake_shell', {})
|
||||
nvim('set_option_value', 'shellcmdflag', 'cmdflag', {})
|
||||
meths.nvim_set_option_value('shell', 'fake_shell', {})
|
||||
meths.nvim_set_option_value('shellcmdflag', 'cmdflag', {})
|
||||
|
||||
screen:try_resize(72, 14)
|
||||
feed(':4verbose echo system("echo hi")<cr>')
|
||||
@@ -346,7 +346,7 @@ describe('system()', function()
|
||||
input[#input + 1] = '01234567890ABCDEFabcdef'
|
||||
end
|
||||
input = table.concat(input, '\n')
|
||||
nvim('set_var', 'input', input)
|
||||
meths.nvim_set_var('input', input)
|
||||
eq(input, eval('system("cat -", g:input)'))
|
||||
end)
|
||||
end)
|
||||
@@ -480,7 +480,7 @@ describe('systemlist()', function()
|
||||
for _ = 1, 0xffff do
|
||||
input[#input + 1] = '01234567890ABCDEFabcdef'
|
||||
end
|
||||
nvim('set_var', 'input', input)
|
||||
meths.nvim_set_var('input', input)
|
||||
eq(input, eval('systemlist("cat -", g:input)'))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -4,7 +4,7 @@ local feed, eq, eval, ok = helpers.feed, helpers.eq, helpers.eval, helpers.ok
|
||||
local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run
|
||||
local clear, command, funcs = helpers.clear, helpers.command, helpers.funcs
|
||||
local exc_exec = helpers.exc_exec
|
||||
local curbufmeths = helpers.curbufmeths
|
||||
local meths = helpers.meths
|
||||
local load_adjust = helpers.load_adjust
|
||||
local retry = helpers.retry
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('timers', function()
|
||||
[1] = { bold = true, foreground = Screen.colors.Blue },
|
||||
})
|
||||
|
||||
curbufmeths.set_lines(0, -1, true, { 'ITEM 1', 'ITEM 2' })
|
||||
meths.nvim_buf_set_lines(0, 0, -1, true, { 'ITEM 1', 'ITEM 2' })
|
||||
source([[
|
||||
let g:cont = 0
|
||||
func! AddItem(timer)
|
||||
|
||||
@@ -7,14 +7,14 @@ local eq = helpers.eq
|
||||
local feed = helpers.feed
|
||||
local feed_command = helpers.feed_command
|
||||
local next_msg = helpers.next_msg
|
||||
local nvim = helpers.nvim
|
||||
local meths = helpers.meths
|
||||
local source = helpers.source
|
||||
local pcall_err = helpers.pcall_err
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
local channel = nvim('get_api_info')[1]
|
||||
nvim('set_var', 'channel', channel)
|
||||
local channel = meths.nvim_get_api_info()[1]
|
||||
meths.nvim_set_var('channel', channel)
|
||||
end)
|
||||
|
||||
describe('wait()', function()
|
||||
@@ -61,13 +61,13 @@ describe('wait()', function()
|
||||
|
||||
-- XXX: flaky (#11137)
|
||||
helpers.retry(nil, nil, function()
|
||||
nvim('set_var', 'counter', 0)
|
||||
meths.nvim_set_var('counter', 0)
|
||||
eq(-1, call('wait', 20, 'Count() >= 5', 99999))
|
||||
end)
|
||||
|
||||
nvim('set_var', 'counter', 0)
|
||||
meths.nvim_set_var('counter', 0)
|
||||
eq(0, call('wait', 10000, 'Count() >= 5', 5))
|
||||
eq(5, nvim('get_var', 'counter'))
|
||||
eq(5, meths.nvim_get_var('counter'))
|
||||
end)
|
||||
|
||||
it('validates args', function()
|
||||
|
||||
Reference in New Issue
Block a user