From ab82369c8eb1bf6a58f848e7cb3fb3275d13ed8b Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 2 Aug 2021 18:59:55 +0100 Subject: 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. --- test/functional/eval/json_functions_spec.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/functional/eval/json_functions_spec.lua') 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) -- cgit