diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2016-11-05 18:12:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-05 18:12:14 +0100 |
commit | 9147331e212e8d0fff0f30344007faffd42609ee (patch) | |
tree | 6d1853a72b94ce19ba0cc163c664a9a206da0091 /test/functional/eval/json_functions_spec.lua | |
parent | 32d9c19e294f38a6adae6e055fc606fc3fd33f2f (diff) | |
parent | 4ab3fe8eaadb5456eeafc49df2fb0ecf71d836cc (diff) | |
download | rneovim-9147331e212e8d0fff0f30344007faffd42609ee.tar.gz rneovim-9147331e212e8d0fff0f30344007faffd42609ee.tar.bz2 rneovim-9147331e212e8d0fff0f30344007faffd42609ee.zip |
Merge pull request #2905 from bfredl/utf8
Only allow encoding=utf-8 and simplify multibyte code
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r-- | test/functional/eval/json_functions_spec.lua | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua index 159d775ff1..4a6758019b 100644 --- a/test/functional/eval/json_functions_spec.lua +++ b/test/functional/eval/json_functions_spec.lua @@ -489,18 +489,6 @@ describe('json_decode() function', function() '{"b": 3, "a": 1, "c": 4, "d": 2, "\\u0000": 4}') end) - it('converts strings to latin1 when &encoding is latin1', function() - restart('--cmd', 'set encoding=latin1') - eq('\171', funcs.json_decode('"\\u00AB"')) - sp_decode_eq({_TYPE='string', _VAL={'\n\171\n'}}, '"\\u0000\\u00AB\\u0000"') - end) - - it('fails to convert string to latin1 if it is impossible', function() - restart('--cmd', 'set encoding=latin1') - eq('Vim(call):E474: Failed to convert string "ꯍ" from UTF-8', - exc_exec('call json_decode(\'"\\uABCD"\')')) - end) - it('parses U+00C3 correctly', function() eq('\195\131', funcs.json_decode('"\195\131"')) end) @@ -528,14 +516,6 @@ describe('json_decode() function', function() eq({key={'val', 'val2'}, key2=1}, funcs.json_decode(str)) end) - it('always treats input as UTF-8', function() - -- When &encoding is latin1 string "«" is U+00C2 U+00AB U+00C2: «Â. So if - -- '"«"' was parsed as latin1 json_decode would return three characters, and - -- only one U+00AB when this string is parsed as latin1. - restart('--cmd', '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' @@ -762,12 +742,6 @@ describe('json_encode() function', function() exc_exec('call json_encode(["", ""], 1)')) end) - it('converts strings from latin1 when &encoding is latin1', function() - clear('--cmd', 'set encoding=latin1') - eq('"\\u00AB"', funcs.json_encode('\171')) - eq('"\\u0000\\u00AB\\u0000"', eval('json_encode({"_TYPE": v:msgpack_types.string, "_VAL": ["\\n\171\\n"]})')) - end) - it('ignores improper values in &isprint', function() meths.set_option('isprint', '1') eq(1, eval('"\1" =~# "\\\\p"')) |