aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/vim_spec.lua6
-rw-r--r--test/functional/vimscript/json_functions_spec.lua4
2 files changed, 7 insertions, 3 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 7287666190..abae346701 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1319,6 +1319,10 @@ describe('API', function()
eq("Key not found: lua", pcall_err(meths.del_var, 'lua'))
meths.set_var('lua', 1)
+ -- Empty keys are allowed in Vim dicts (and msgpack).
+ nvim('set_var', 'dict_empty_key', {[''] = 'empty key'})
+ eq({[''] = 'empty key'}, nvim('get_var', 'dict_empty_key'))
+
-- Set locked g: var.
command('lockvar lua')
eq('Key is locked: lua', pcall_err(meths.del_var, 'lua'))
@@ -1983,7 +1987,7 @@ describe('API', function()
it('errors when context dictionary is invalid', function()
eq('E474: Failed to convert list to msgpack string buffer',
pcall_err(nvim, 'load_context', { regs = { {} }, jumps = { {} } }))
- eq("Empty dictionary keys aren't allowed",
+ eq('E474: Failed to convert list to msgpack string buffer',
pcall_err(nvim, 'load_context', { regs = { { [''] = '' } } }))
end)
end)
diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua
index 53899085e0..c12bcf5099 100644
--- a/test/functional/vimscript/json_functions_spec.lua
+++ b/test/functional/vimscript/json_functions_spec.lua
@@ -576,8 +576,8 @@ describe('json_encode() function', function()
eq('{}', eval('json_encode({})'))
eq('{"d": []}', funcs.json_encode({d={}}))
eq('{"d": [], "e": []}', funcs.json_encode({d={}, e={}}))
- -- Empty keys not allowed (yet?) in object_to_vim() (since 7c01d5ff9286). #25564
- -- eq('{"": []}', funcs.json_encode({['']={}}))
+ -- Empty keys are allowed per JSON spec (and Vim dicts, and msgpack).
+ eq('{"": []}', funcs.json_encode({['']={}}))
end)
it('cannot dump generic mapping with generic mapping keys and values',