diff options
author | ZyX <kp-pav@yandex.ru> | 2016-02-21 21:33:58 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-04-18 02:48:20 +0300 |
commit | 406562ac6d3863dfdaedbf40f9d4a23ca37c9ec5 (patch) | |
tree | 41ce87f9348c73f8600e736d24a1de17d4114906 /test/functional/eval/json_functions_spec.lua | |
parent | 7cdd01983aeb452e0a3f3eb027e75fe02ce48718 (diff) | |
download | rneovim-406562ac6d3863dfdaedbf40f9d4a23ca37c9ec5.tar.gz rneovim-406562ac6d3863dfdaedbf40f9d4a23ca37c9ec5.tar.bz2 rneovim-406562ac6d3863dfdaedbf40f9d4a23ca37c9ec5.zip |
encode: Fail to dump NaN and infinity
Thanks to vim/vim#654
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r-- | test/functional/eval/json_functions_spec.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua index 0b0403ce8e..33d177a2b6 100644 --- a/test/functional/eval/json_functions_spec.lua +++ b/test/functional/eval/json_functions_spec.lua @@ -472,6 +472,15 @@ describe('json_encode() function', function() eq('1.0e50', eval('json_encode(1.0e50)')) end) + it('fails to dump NaN and infinite values', function() + eq('Vim(call):E474: Unable to represent NaN value in JSON', + exc_exec('call json_encode(str2float("nan"))')) + eq('Vim(call):E474: Unable to represent infinity in JSON', + exc_exec('call json_encode(str2float("inf"))')) + eq('Vim(call):E474: Unable to represent infinity in JSON', + exc_exec('call json_encode(-str2float("inf"))')) + end) + it('dumps lists', function() eq('[]', funcs.json_encode({})) eq('[[]]', funcs.json_encode({{}})) |