mirror of
https://github.com/neovim/neovim.git
synced 2025-11-13 13:59:16 +00:00
tests: Add tests for partials dumping
Also fixed dumping of partials by encode_vim_to_object and added code which is able to work with partials and dictionaries to test/unit/eval/helpers.lua (mostly copied from #5119, except for partials handling).
This commit is contained in:
@@ -493,6 +493,12 @@ describe('msgpackparse() function', function()
|
||||
exc_exec('call msgpackparse(function("tr"))'))
|
||||
end)
|
||||
|
||||
it('fails to parse a partial', function()
|
||||
execute('function T() dict\nendfunction')
|
||||
eq('Vim(call):E686: Argument of msgpackparse() must be a List',
|
||||
exc_exec('call msgpackparse(function("T", [1, 2], {}))'))
|
||||
end)
|
||||
|
||||
it('fails to parse a float', function()
|
||||
eq('Vim(call):E686: Argument of msgpackparse() must be a List',
|
||||
exc_exec('call msgpackparse(0.0)'))
|
||||
@@ -570,6 +576,13 @@ describe('msgpackdump() function', function()
|
||||
exc_exec('call msgpackdump([Todump])'))
|
||||
end)
|
||||
|
||||
it('fails to dump a partial', function()
|
||||
execute('function T() dict\nendfunction')
|
||||
execute('let Todump = function("T", [1, 2], {})')
|
||||
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
|
||||
exc_exec('call msgpackdump([Todump])'))
|
||||
end)
|
||||
|
||||
it('fails to dump a function reference in a list', function()
|
||||
execute('let todump = [function("tr")]')
|
||||
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, index 0: attempt to dump function reference',
|
||||
@@ -675,6 +688,12 @@ describe('msgpackdump() function', function()
|
||||
exc_exec('call msgpackdump(function("tr"))'))
|
||||
end)
|
||||
|
||||
it('fails to dump a partial', function()
|
||||
execute('function T() dict\nendfunction')
|
||||
eq('Vim(call):E686: Argument of msgpackdump() must be a List',
|
||||
exc_exec('call msgpackdump(function("T", [1, 2], {}))'))
|
||||
end)
|
||||
|
||||
it('fails to dump a float', function()
|
||||
eq('Vim(call):E686: Argument of msgpackdump() must be a List',
|
||||
exc_exec('call msgpackdump(0.0)'))
|
||||
|
||||
Reference in New Issue
Block a user