aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-29 05:09:54 +0300
committerZyX <kp-pav@yandex.ru>2017-03-27 00:12:42 +0300
commitb4e2860c69a4e96fa305b535ce0dbdde37632fe1 (patch)
tree5cdf5fb236d5c514835033d6af9fbf9716a0c82b /test/functional/lua
parent7a5646d594ef4ed97f1969103a1cee32733bfa2d (diff)
downloadrneovim-b4e2860c69a4e96fa305b535ce0dbdde37632fe1.tar.gz
rneovim-b4e2860c69a4e96fa305b535ce0dbdde37632fe1.tar.bz2
rneovim-b4e2860c69a4e96fa305b535ce0dbdde37632fe1.zip
doc,functests: Add documentation
Missing: updates to various lists.
Diffstat (limited to 'test/functional/lua')
-rw-r--r--test/functional/lua/commands_spec.lua8
-rw-r--r--test/functional/lua/luaeval_spec.lua1
2 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua
index 6a37d1fd1b..c607889edb 100644
--- a/test/functional/lua/commands_spec.lua
+++ b/test/functional/lua/commands_spec.lua
@@ -2,8 +2,10 @@
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
+local NIL = helpers.NIL
local clear = helpers.clear
local meths = helpers.meths
+local funcs = helpers.funcs
local source = helpers.source
local dedent = helpers.dedent
local exc_exec = helpers.exc_exec
@@ -54,4 +56,10 @@ describe(':lua command', function()
]])
eq({'', 'ETTS', 'TTSE', 'STTE'}, curbufmeths.get_lines(0, 100, false))
end)
+ it('preserves global and not preserves local variables', function()
+ eq('', redir_exec('lua gvar = 42'))
+ eq('', redir_exec('lua local lvar = 100500'))
+ eq(NIL, funcs.luaeval('lvar'))
+ eq(42, funcs.luaeval('gvar'))
+ end)
end)
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index b0169c3d6b..6132d44bee 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -46,6 +46,7 @@ describe('luaeval()', function()
funcs.luaeval('{n=1, f=1.5, s="string", l={4, 2}}'))
-- Not tested: nil inside containers: behaviour will most likely change.
eq(NIL, funcs.luaeval('nil'))
+ eq({['']=1}, funcs.luaeval('{[""]=1}'))
end)
end)
describe('recursive lua values', function()