aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorAmit Singh <amitds1997@gmail.com>2024-07-11 15:56:52 +0530
committerAmit Singh <amitds1997@gmail.com>2024-07-13 16:42:28 +0530
commit970a27927eb31bdc735f0d7d5e3d07784486c6de (patch)
tree6a106fbbaef11a504ca60dfaea663b7e3bd5e11f /test/functional/api/vim_spec.lua
parentb1aa8f5eb8a5407e869335e9987b73f8515c37e5 (diff)
downloadrneovim-970a27927eb31bdc735f0d7d5e3d07784486c6de.tar.gz
rneovim-970a27927eb31bdc735f0d7d5e3d07784486c6de.tar.bz2
rneovim-970a27927eb31bdc735f0d7d5e3d07784486c6de.zip
fix(lua)!: do not use typed table for empty dict
Problem: Empty dictionaries are converted into typed tables of the form `{ [true] = 6}` instead of an empty dictionary representation `{}`. This leads to incorrect table representation, along with failure in JSON encoding of such tables as currently tables with only string and number type keys can be encoded. Solution: The typed table logic has been removed from `nlua_push_Dictionary`. The typed table logic is required only for float value conversions which is already handled in `nlua_push_Float`. So, it is(was) no longer required here. Fixes neovim/neovim#29218
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 86ea8679b5..bd16f0785b 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1500,6 +1500,8 @@ describe('API', function()
eq('Dictionary is locked', pcall_err(request, 'nvim_set_vvar', 'nosuchvar', 42))
api.nvim_set_vvar('errmsg', 'set by API')
eq('set by API', api.nvim_get_vvar('errmsg'))
+ api.nvim_set_vvar('completed_item', { word = 'a', user_data = vim.empty_dict() })
+ eq({}, api.nvim_get_vvar('completed_item')['user_data'])
api.nvim_set_vvar('errmsg', 42)
eq('42', eval('v:errmsg'))
api.nvim_set_vvar('oldfiles', { 'one', 'two' })