mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
test: add more structure to vim.bo/wo tests
This commit is contained in:
parent
c966654faa
commit
d27bbebf8e
@ -504,7 +504,8 @@ describe('lua stdlib', function()
|
||||
end)
|
||||
|
||||
describe('options', function()
|
||||
it('vim.bo', function()
|
||||
describe('vim.bo', function()
|
||||
it('can get and set options', function()
|
||||
eq('', fn.luaeval 'vim.bo.filetype')
|
||||
exec_lua(function()
|
||||
_G.BUF = vim.api.nvim_create_buf(false, true)
|
||||
@ -520,12 +521,17 @@ describe('lua stdlib', function()
|
||||
end)
|
||||
eq('', fn.luaeval 'vim.bo.filetype')
|
||||
eq(true, fn.luaeval 'vim.bo[BUF].modifiable')
|
||||
end)
|
||||
|
||||
it('errors', function()
|
||||
matches("Unknown option 'nosuchopt'$", pcall_err(exec_lua, 'return vim.bo.nosuchopt'))
|
||||
matches('Expected Lua string$', pcall_err(exec_lua, 'return vim.bo[0][0].autoread'))
|
||||
matches('Invalid buffer id: %-1$', pcall_err(exec_lua, 'return vim.bo[-1].filetype'))
|
||||
end)
|
||||
end)
|
||||
|
||||
it('vim.wo', function()
|
||||
describe('vim.wo', function()
|
||||
it('can get and set options', function()
|
||||
exec_lua(function()
|
||||
vim.api.nvim_set_option_value('cole', 2, {})
|
||||
vim.cmd 'split'
|
||||
@ -557,11 +563,13 @@ describe('lua stdlib', function()
|
||||
vim.cmd 'enew'
|
||||
end)
|
||||
eq(100, fn.luaeval 'vim.wo.scrolloff')
|
||||
end)
|
||||
|
||||
it('errors', function()
|
||||
matches('only bufnr=0 is supported', pcall_err(exec_lua, 'vim.wo[0][10].signcolumn = "no"'))
|
||||
|
||||
matches('only bufnr=0 is supported', pcall_err(exec_lua, 'local a = vim.wo[0][10].signcolumn'))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('vim.opt', function()
|
||||
-- TODO: We still need to write some tests for optlocal, opt and then getting the options
|
||||
|
Loading…
Reference in New Issue
Block a user