aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/json_functions_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r--test/functional/eval/json_functions_spec.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 7ec3882a58..aa36b62757 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -451,6 +451,19 @@ describe('json_decode() function', function()
it('parses U+00C3 correctly', function()
eq('\xC3\x83', funcs.json_decode('"\xC3\x83"'))
end)
+
+ it('fails to parse empty string', function()
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode("")'))
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode(" ")'))
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode("\\t")'))
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode("\\n")'))
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode(" \\t\\n \\n\\t\\t \\n\\t\\n \\n \\t\\n\\t ")'))
+ end)
end)
describe('json_encode() function', function()