diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-01-14 00:40:38 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-01-14 00:50:29 +0100 |
commit | 38b925643949c9422906f264d004168d9b745b74 (patch) | |
tree | 5195c355cf72918ea8396c3d213ee1098299f010 /test/functional/api/vim_spec.lua | |
parent | 475b97e021813d890b1d678dc43916df9e73d966 (diff) | |
download | rneovim-38b925643949c9422906f264d004168d9b745b74.tar.gz rneovim-38b925643949c9422906f264d004168d9b745b74.tar.bz2 rneovim-38b925643949c9422906f264d004168d9b745b74.zip |
test/API: nvim_set_vvar() #9395
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 15 |
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} |