aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-14 02:13:39 +0100
committerGitHub <noreply@github.com>2019-01-14 02:13:39 +0100
commit989fbad5028a2f7d31fef944aac166d562665477 (patch)
tree060127c234e339cc4bd7b78e6b5dedcc64ddafd4 /test/functional
parent0d66cdc6f9c1ac25ab13223c807a4a75d3ee23a2 (diff)
parent38b925643949c9422906f264d004168d9b745b74 (diff)
downloadrneovim-989fbad5028a2f7d31fef944aac166d562665477.tar.gz
rneovim-989fbad5028a2f7d31fef944aac166d562665477.tar.bz2
rneovim-989fbad5028a2f7d31fef944aac166d562665477.zip
Merge #9395 from pqzx/api-set-vvar
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/vim_spec.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 52e41ca856..0e06e48a35 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -351,8 +351,8 @@ describe('API', function()
end)
end)
- describe('nvim_get_var, nvim_set_var, nvim_del_var', function()
- it('works', function()
+ describe('set/get/del variables', function()
+ it('nvim_get_var, nvim_set_var, nvim_del_var', function()
nvim('set_var', 'lua', {1, 2, {['3'] = 1}})
eq({1, 2, {['3'] = 1}}, nvim('get_var', 'lua'))
eq({1, 2, {['3'] = 1}}, nvim('eval', 'g:lua'))
@@ -361,11 +361,22 @@ describe('API', function()
eq(0, funcs.exists('g:lua'))
eq({false, "Key not found: lua"}, meth_pcall(meths.del_var, 'lua'))
meths.set_var('lua', 1)
+
+ -- Set locked g: var.
command('lockvar lua')
eq({false, 'Key is locked: lua'}, meth_pcall(meths.del_var, 'lua'))
eq({false, 'Key is locked: lua'}, meth_pcall(meths.set_var, 'lua', 1))
end)
+ it('nvim_get_vvar, nvim_set_vvar', function()
+ -- Set readonly v: var.
+ expect_err('Key is read%-only: count$', request,
+ 'nvim_set_vvar', 'count', 42)
+ -- Set writable v: var.
+ meths.set_vvar('errmsg', 'set by API')
+ eq('set by API', meths.get_vvar('errmsg'))
+ end)
+
it('vim_set_var returns the old value', function()
local val1 = {1, 2, {['3'] = 1}}
local val2 = {4, 7}