aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-04 13:45:32 +0100
committerGitHub <noreply@github.com>2020-12-04 13:45:32 +0100
commit6c344a75d4d312ca1b514b37d3a37bb2ebc07388 (patch)
treee7c045a88c37ac60ba2148a351a1816cb7216b87 /test/functional/api/vim_spec.lua
parent44be2dfca192db9f47d59c6bb29975c9730c5827 (diff)
parent17a58043a3fc49179a47590e905ed3a7d5a29907 (diff)
downloadrneovim-6c344a75d4d312ca1b514b37d3a37bb2ebc07388.tar.gz
rneovim-6c344a75d4d312ca1b514b37d3a37bb2ebc07388.tar.bz2
rneovim-6c344a75d4d312ca1b514b37d3a37bb2ebc07388.zip
Merge pull request #13173 from tjdevries/tjdevries/option_info
api: add option metadata
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index eb5fd7eca7..c42d5c34cc 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1921,4 +1921,79 @@ describe('API', function()
eq({}, meths.get_runtime_file("foobarlang/", true))
end)
end)
+
+ describe('nvim_get_all_options_info', function()
+ it('should have key value pairs of option names', function()
+ local options_info = meths.get_all_options_info()
+ neq(nil, options_info.listchars)
+ neq(nil, options_info.tabstop)
+
+ eq(meths.get_option_info'winhighlight', options_info.winhighlight)
+ 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()
+ eq({
+ commalist = false;
+ default = "";
+ flaglist = false;
+ global_local = false;
+ last_set_chan = 0;
+ last_set_linenr = 0;
+ last_set_sid = 0;
+ name = "winhighlight";
+ scope = "win";
+ shortname = "winhl";
+ type = "string";
+ was_set = false;
+ }, meths.get_option_info'winhl')
+ end)
+
+ it('should have information about buffer options', function()
+ eq({
+ commalist = false,
+ default = "",
+ flaglist = false,
+ global_local = false,
+ last_set_chan = 0,
+ last_set_linenr = 0,
+ last_set_sid = 0,
+ name = "filetype",
+ scope = "buf",
+ shortname = "ft",
+ type = "string",
+ was_set = false
+ }, meths.get_option_info'filetype')
+ end)
+
+ it('should have information about global options', function()
+ -- precondition: the option was changed from its default
+ -- in test setup.
+ eq(false, meths.get_option'showcmd')
+
+ eq({
+ commalist = false,
+ default = true,
+ flaglist = false,
+ global_local = false,
+ last_set_chan = 0,
+ last_set_linenr = 0,
+ last_set_sid = -2,
+ name = "showcmd",
+ scope = "global",
+ shortname = "sc",
+ type = "boolean",
+ was_set = true
+ }, meths.get_option_info'showcmd')
+ end)
+ end)
end)