api: make nvim[_obj]_set_var and _del_var not return the old value

This commit is contained in:
Björn Linse
2016-09-14 11:17:07 +02:00
parent c61bf43a90
commit cd08e6cf72
12 changed files with 235 additions and 64 deletions

View File

@@ -88,19 +88,19 @@ describe('vim_* functions', function()
eq(0, funcs.exists('g:lua'))
end)
it('set_var returns the old value', function()
it('vim_set_var returns the old value', function()
local val1 = {1, 2, {['3'] = 1}}
local val2 = {4, 7}
eq(NIL, nvim('set_var', 'lua', val1))
eq(val1, nvim('set_var', 'lua', val2))
eq(NIL, request('vim_set_var', 'lua', val1))
eq(val1, request('vim_set_var', 'lua', val2))
end)
it('del_var returns the old value', function()
it('vim_del_var returns the old value', function()
local val1 = {1, 2, {['3'] = 1}}
local val2 = {4, 7}
eq(NIL, meths.set_var('lua', val1))
eq(val1, meths.set_var('lua', val2))
eq(val2, meths.del_var('lua'))
eq(NIL, request('vim_set_var', 'lua', val1))
eq(val1, request('vim_set_var', 'lua', val2))
eq(val2, request('vim_del_var', 'lua'))
end)
it('truncates values with NULs in them', function()