aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/msgpack_functions_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-01-31 01:25:00 +0300
committerZyX <kp-pav@yandex.ru>2016-04-18 02:44:03 +0300
commitd70a322c40e849f98ad573d2a37dc680c5616b26 (patch)
treeabe3c021dd0d7e9ae0f0f7a6b23d4ec8f548f930 /test/functional/eval/msgpack_functions_spec.lua
parent18903bd9b88ec960cb36b1ddd2b5062aad4bac2e (diff)
downloadrneovim-d70a322c40e849f98ad573d2a37dc680c5616b26.tar.gz
rneovim-d70a322c40e849f98ad573d2a37dc680c5616b26.tar.bz2
rneovim-d70a322c40e849f98ad573d2a37dc680c5616b26.zip
eval: Add special variables v:false, v:null, v:none
Diffstat (limited to 'test/functional/eval/msgpack_functions_spec.lua')
-rw-r--r--test/functional/eval/msgpack_functions_spec.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua
index fc0aad7902..0c91471656 100644
--- a/test/functional/eval/msgpack_functions_spec.lua
+++ b/test/functional/eval/msgpack_functions_spec.lua
@@ -1,5 +1,6 @@
local helpers = require('test.functional.helpers')
local clear = helpers.clear
+local funcs = helpers.funcs
local eval, eq = helpers.eval, helpers.eq
local execute = helpers.execute
local nvim = helpers.nvim
@@ -517,6 +518,19 @@ describe('msgpackdump() function', function()
eq({'\129\128\128'}, eval('msgpackdump([todump])'))
end)
+ it('can dump v:true', function()
+ eq({'\195'}, funcs.msgpackdump({true}))
+ end)
+
+ it('can dump v:false', function()
+ eq({'\194'}, funcs.msgpackdump({false}))
+ end)
+
+ it('can v:null', function()
+ execute('let todump = v:null')
+ eq({'\192'}, eval('msgpackdump([todump])'))
+ end)
+
it('can dump special ext mapping', function()
execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
eq({'\212\005', ''}, eval('msgpackdump([todump])'))
@@ -620,6 +634,11 @@ describe('msgpackdump() function', function()
exc_exec('call msgpackdump([todump])'))
end)
+ it('fails to dump v:none', function()
+ eq('Vim(call):E953: Attempt to convert v:none in msgpackdump() argument, index 0, itself',
+ exc_exec('call msgpackdump([v:none])'))
+ end)
+
it('fails when called with no arguments', function()
eq('Vim(call):E119: Not enough arguments for function: msgpackdump',
exc_exec('call msgpackdump()'))
@@ -654,4 +673,11 @@ describe('msgpackdump() function', function()
eq('Vim(call):E686: Argument of msgpackdump() must be a List',
exc_exec('call msgpackdump(0.0)'))
end)
+
+ it('fails to dump special value', function()
+ for _, val in ipairs({'v:true', 'v:false', 'v:null', 'v:none'}) do
+ eq('Vim(call):E686: Argument of msgpackdump() must be a List',
+ exc_exec('call msgpackdump(' .. val .. ')'))
+ end
+ end)
end)