aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/buf_functions_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/vimscript/buf_functions_spec.lua')
-rw-r--r--test/functional/vimscript/buf_functions_spec.lua26
1 files changed, 11 insertions, 15 deletions
diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua
index c93e55df5f..34206b15ae 100644
--- a/test/functional/vimscript/buf_functions_spec.lua
+++ b/test/functional/vimscript/buf_functions_spec.lua
@@ -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)