diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-02 18:59:55 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-15 21:19:29 +0100 |
commit | ab82369c8eb1bf6a58f848e7cb3fb3275d13ed8b (patch) | |
tree | 8472fd5ecf6f23e2cfe60f0293e8f126e2e6aa67 /test/functional/eval/json_functions_spec.lua | |
parent | 312c783d81544df7ab3342f4b3316ced931e89b8 (diff) | |
download | rneovim-ab82369c8eb1bf6a58f848e7cb3fb3275d13ed8b.tar.gz rneovim-ab82369c8eb1bf6a58f848e7cb3fb3275d13ed8b.tar.bz2 rneovim-ab82369c8eb1bf6a58f848e7cb3fb3275d13ed8b.zip |
feat(json): convert Blobs to array of byte values
Similiar to how Vim does it, but to be consistent with how Nvim encodes
lists, add a space after every comma.
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 8dcaea806e..9b5e207c07 100644 --- a/test/functional/eval/json_functions_spec.lua +++ b/test/functional/eval/json_functions_spec.lua @@ -538,6 +538,11 @@ describe('json_encode() function', function() eq('"þÿþ"', funcs.json_encode('þÿþ')) end) + it('dumps blobs', function() + eq('[]', eval('json_encode(0z)')) + eq('[222, 173, 190, 239]', eval('json_encode(0zDEADBEEF)')) + end) + it('dumps numbers', function() eq('0', funcs.json_encode(0)) eq('10', funcs.json_encode(10)) @@ -769,6 +774,10 @@ describe('json_encode() function', function() eq('""', eval('json_encode($XXX_UNEXISTENT_VAR_XXX)')) end) + it('can dump NULL blob', function() + eq('[]', eval('json_encode(v:_null_blob)')) + end) + it('can dump NULL list', function() eq('[]', eval('json_encode(v:_null_list)')) end) |