test: use integers for API Buffer/Window/Tabpage EXT types

This commit is contained in:
Lewis Russell
2024-01-16 13:26:21 +00:00
committed by Lewis Russell
parent 91dc04a5e1
commit 8f02ae82e2
25 changed files with 622 additions and 651 deletions

View File

@@ -243,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 windows buffer is 2, but getbufvar() receives 1)
eq({ id = 2 }, api.nvim_win_get_buf(0))
eq(2, api.nvim_win_get_buf(0))
eq(1, fn.getbufvar(1, '&number'))
eq(1, fn.getbufvar(1, '&l:number'))
-- You can get global value though, if you find this useful.
@@ -287,18 +287,18 @@ describe('setbufvar() function', function()
eq(2, api.nvim_buf_get_number(api.nvim_win_get_buf(0)))
fn.setbufvar(1, '&number', true)
local windows = api.nvim_tabpage_list_wins(0)
eq(false, api.nvim_get_option_value('number', { win = windows[1].id }))
eq(true, api.nvim_get_option_value('number', { win = windows[2].id }))
eq(false, api.nvim_get_option_value('number', { win = windows[3].id }))
eq(false, api.nvim_get_option_value('number', { win = api.nvim_get_current_win().id }))
eq(false, api.nvim_get_option_value('number', { win = windows[1] }))
eq(true, api.nvim_get_option_value('number', { win = windows[2] }))
eq(false, api.nvim_get_option_value('number', { win = windows[3] }))
eq(false, api.nvim_get_option_value('number', { win = api.nvim_get_current_win() }))
eq(true, api.nvim_get_option_value('hidden', {}))
fn.setbufvar(1, '&hidden', 0)
eq(false, api.nvim_get_option_value('hidden', {}))
eq(false, api.nvim_get_option_value('autoindent', { buf = buf1.id }))
eq(false, api.nvim_get_option_value('autoindent', { buf = buf1 }))
fn.setbufvar(1, '&autoindent', true)
eq(true, api.nvim_get_option_value('autoindent', { buf = buf1.id }))
eq(true, api.nvim_get_option_value('autoindent', { buf = buf1 }))
eq('Vim(call):E355: Unknown option: xxx', exc_exec('call setbufvar(1, "&xxx", 0)'))
end)
it('may set variables', function()