api/options: fixup

This commit is contained in:
TJ DeVries
2020-12-03 20:59:36 -05:00
committed by Björn Linse
parent 3b3c006ae3
commit ced951c2aa
4 changed files with 142 additions and 20 deletions

View File

@@ -1921,4 +1921,57 @@ describe('API', function()
eq({}, meths.get_runtime_file("foobarlang/", true))
end)
end)
describe('nvim_get_options_info', function()
it('should have key value pairs of option names', function()
local options_info = meths.get_options_info()
neq(nil, options_info.listchars)
neq(nil, options_info.tabstop)
end)
end)
describe('nvim_get_option_info', function()
it('should error for unknown options', function()
eq("no such option: 'bogus'",
pcall_err(meths.get_option_info, 'bogus'))
end)
it('should return the same options for short and long name', function()
eq(
meths.get_option_info('winhl'),
meths.get_option_info('winhighlight')
)
end)
it('should have information about window options', function()
local winhl_info = meths.get_option_info('winhl')
eq(true, winhl_info.win)
eq(false, winhl_info.buf)
eq('string', winhl_info.type)
eq('winhighlight', winhl_info.name)
eq('winhl', winhl_info.shortname)
eq('', winhl_info.default)
end)
it('should have information about buffer options', function()
local filetype_info = meths.get_option_info('filetype')
eq(false, filetype_info.win)
eq(true, filetype_info.buf)
eq('string', filetype_info.type)
eq('filetype', filetype_info.name)
eq('ft', filetype_info.shortname)
eq('', filetype_info.default)
end)
it('should have information about global options', function()
local showcmd_info = meths.get_option_info('showcmd')
eq(false, showcmd_info.win)
eq(false, showcmd_info.buf)
eq(false, showcmd_info.global_local)
eq('boolean', showcmd_info.type)
eq('showcmd', showcmd_info.name)
eq('sc', showcmd_info.shortname)
eq(true, showcmd_info.default)
end)
end)
end)