aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/json_functions_spec.lua
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-10-10 16:48:24 -0400
committerGitHub <noreply@github.com>2021-10-10 16:48:24 -0400
commitb3e0d6708eca3cd22695d364ba2aca7401cc0f8c (patch)
treee2742ee0a6b33161887d9dab6069357e337aa302 /test/functional/vimscript/json_functions_spec.lua
parent62eec98d5feee9173ea2decb2d7cb72971c24f8b (diff)
parenta8504638cd2497b3bdd0daf27dcc50903e1e2bb9 (diff)
downloadrneovim-b3e0d6708eca3cd22695d364ba2aca7401cc0f8c.tar.gz
rneovim-b3e0d6708eca3cd22695d364ba2aca7401cc0f8c.tar.bz2
rneovim-b3e0d6708eca3cd22695d364ba2aca7401cc0f8c.zip
Merge pull request #15502 from seandewar/vim-8.1.1921
Add method call support for more built-ins: vim-patch:8.1.{1336,1952,1961,1984}
Diffstat (limited to 'test/functional/vimscript/json_functions_spec.lua')
-rw-r--r--test/functional/vimscript/json_functions_spec.lua8
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()