diff options
author | ZyX <kp-pav@yandex.ru> | 2016-02-03 21:46:01 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-04-18 02:45:49 +0300 |
commit | 5814e29cdbe370a417d654dbd18620849aa00a09 (patch) | |
tree | cb9c245c0fef3990abf0dbfc4ce986fa1303b05a /test/functional/eval/json_functions_spec.lua | |
parent | ea82270d30eef2dd716cd158d989f96fbd503ba6 (diff) | |
download | rneovim-5814e29cdbe370a417d654dbd18620849aa00a09.tar.gz rneovim-5814e29cdbe370a417d654dbd18620849aa00a09.tar.bz2 rneovim-5814e29cdbe370a417d654dbd18620849aa00a09.zip |
eval/decode: Fix surrogate pairs processing
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r-- | test/functional/eval/json_functions_spec.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua index 9167cb2fef..651f6c27b3 100644 --- a/test/functional/eval/json_functions_spec.lua +++ b/test/functional/eval/json_functions_spec.lua @@ -297,6 +297,24 @@ describe('jsondecode() function', function() -- '"\xF9\x80\x80\x80\x80"', -- '"\xFC\x90\x80\x80\x80\x80"', end) + + it('parses surrogate pairs properly', function() + eq('\xF0\x90\x80\x80', funcs.jsondecode('"\\uD800\\uDC00"')) + eq('\xED\xA0\x80a\xED\xB0\x80', funcs.jsondecode('"\\uD800a\\uDC00"')) + eq('\xED\xA0\x80\t\xED\xB0\x80', funcs.jsondecode('"\\uD800\\t\\uDC00"')) + + eq('\xED\xA0\x80', funcs.jsondecode('"\\uD800"')) + eq('\xED\xA0\x80a', funcs.jsondecode('"\\uD800a"')) + eq('\xED\xA0\x80\t', funcs.jsondecode('"\\uD800\\t"')) + + eq('\xED\xB0\x80', funcs.jsondecode('"\\uDC00"')) + eq('\xED\xB0\x80a', funcs.jsondecode('"\\uDC00a"')) + eq('\xED\xB0\x80\t', funcs.jsondecode('"\\uDC00\\t"')) + + eq('\xED\xB0\x80', funcs.jsondecode('"\\uDC00"')) + eq('a\xED\xB0\x80', funcs.jsondecode('"a\\uDC00"')) + eq('\t\xED\xB0\x80', funcs.jsondecode('"\\t\\uDC00"')) + end) end) describe('jsonencode() function', function() |