diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-31 23:49:43 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-10-03 20:06:33 +0100 |
commit | 86593beaa40035a10a664d3147327a01f4885cb7 (patch) | |
tree | 9a305c6bc4c1497bc9c40d38e059a6593c0d363b /test/functional/vimscript/json_functions_spec.lua | |
parent | 59c8a1fd5158886cb13b56070ebf15259d12eba2 (diff) | |
download | rneovim-86593beaa40035a10a664d3147327a01f4885cb7.tar.gz rneovim-86593beaa40035a10a664d3147327a01f4885cb7.tar.bz2 rneovim-86593beaa40035a10a664d3147327a01f4885cb7.zip |
feat(eval/method): partially port v8.1.1954
Does not include listener_*() functions.
js_*() functions are N/A.
json_encode() and json_decode() didn't include tests; add some anyway
(to json_functions_spec.lua).
test_lua.vim isn't included yet, so add tests to luaeval_spec.lua.
Diffstat (limited to 'test/functional/vimscript/json_functions_spec.lua')
-rw-r--r-- | test/functional/vimscript/json_functions_spec.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua index c3b607b544..5d1597f53d 100644 --- a/test/functional/vimscript/json_functions_spec.lua +++ b/test/functional/vimscript/json_functions_spec.lua @@ -168,7 +168,8 @@ describe('json_decode() function', function() end) it('parses floating-point numbers', function() - eq('100000.0', eval('string(json_decode("100000.0"))')) + -- Also test method call (->) syntax + eq('100000.0', eval('"100000.0"->json_decode()->string()')) eq(100000.5, funcs.json_decode('100000.5')) eq(-100000.5, funcs.json_decode('-100000.5')) eq(-100000.5e50, funcs.json_decode('-100000.5e50')) @@ -549,11 +550,12 @@ describe('json_encode() function', function() end) it('dumps floats', function() - eq('0.0', eval('json_encode(0.0)')) + -- Also test method call (->) syntax + eq('0.0', eval('0.0->json_encode()')) eq('10.5', funcs.json_encode(10.5)) eq('-10.5', funcs.json_encode(-10.5)) eq('-1.0e-5', funcs.json_encode(-1e-5)) - eq('1.0e50', eval('json_encode(1.0e50)')) + eq('1.0e50', eval('1.0e50->json_encode()')) end) it('fails to dump NaN and infinite values', function() |