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.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 13597eb7a0..398fab6c4b 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -663,4 +663,11 @@ describe('jsonencode() function', function()
eq(1, eval('"\x01" =~# "\\\\p"'))
eq('"\\u0001"', funcs.jsonencode('\x01'))
end)
+
+ it('fails when using surrogate character in a UTF-8 string', function()
+ eq('Vim(call):E474: UTF-8 string contains code point which belongs to a surrogate pair: \xED\xA0\x80',
+ exc_exec('call jsonencode("\xED\xA0\x80")'))
+ eq('Vim(call):E474: UTF-8 string contains code point which belongs to a surrogate pair: \xED\xAF\xBF',
+ exc_exec('call jsonencode("\xED\xAF\xBF")'))
+ end)
end)