aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/json_functions_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-03-20 19:55:59 +0300
committerZyX <kp-pav@yandex.ru>2016-04-18 02:48:20 +0300
commitaf7ff808c73110f04aadaaab72eac6307dae0cc2 (patch)
tree306711e37740450230b819bcf3858ff1c887e096 /test/functional/eval/json_functions_spec.lua
parent9709cf2cdbd98403aede9edbc8bbe435aeefb463 (diff)
downloadrneovim-af7ff808c73110f04aadaaab72eac6307dae0cc2.tar.gz
rneovim-af7ff808c73110f04aadaaab72eac6307dae0cc2.tar.bz2
rneovim-af7ff808c73110f04aadaaab72eac6307dae0cc2.zip
eval: Fix overflow in error message in f_json_decode
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r--test/functional/eval/json_functions_spec.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index bed9d668fa..091b6f5457 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -6,6 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval
local execute = helpers.execute
local exc_exec = helpers.exc_exec
+local redir_exec = helpers.redir_exec
describe('json_decode() function', function()
local restart = function(cmd)
@@ -529,6 +530,13 @@ describe('json_decode() function', function()
restart('set encoding=latin1')
eq(('%c'):format(0xAB), funcs.json_decode('"«"'))
end)
+
+ it('does not overflow when writing error message about decoding ["", ""]',
+ function()
+ eq('\nE474: Attempt to decode a blank string'
+ .. '\nE474: Failed to parse \n',
+ redir_exec('call json_decode(["", ""])'))
+ end)
end)
describe('json_encode() function', function()