mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
@@ -146,6 +146,7 @@ Object dict_set_value(dict_T *dict, String key, Object value, Error *err)
|
||||
dict_add(dict, di);
|
||||
} else {
|
||||
// Return the old value
|
||||
rv = vim_to_object(&di->di_tv);
|
||||
clear_tv(&di->di_tv);
|
||||
}
|
||||
|
||||
|
@@ -62,6 +62,13 @@ describe('vim_* functions', function()
|
||||
eq({1, 2, {['3'] = 1}}, nvim('eval', 'g:lua'))
|
||||
end)
|
||||
|
||||
it('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))
|
||||
end)
|
||||
|
||||
it('truncates values with NULs in them', function()
|
||||
nvim('set_var', 'xxx', 'ab\0cd')
|
||||
eq('ab', nvim('get_var', 'xxx'))
|
||||
|
Reference in New Issue
Block a user