aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-03-01 14:27:19 +0100
committerbfredl <bjorn.linse@gmail.com>2022-03-03 20:03:30 +0100
commitf9faba88fdc46b2dd1a979a37ba61b000830ff3a (patch)
tree2780af6feccd0d488c32578f535257fa358b0813 /test/functional/lua/vim_spec.lua
parent7211d8ef21cd93365c5f0582c5a0115e84c011ce (diff)
downloadrneovim-f9faba88fdc46b2dd1a979a37ba61b000830ff3a.tar.gz
rneovim-f9faba88fdc46b2dd1a979a37ba61b000830ff3a.tar.bz2
rneovim-f9faba88fdc46b2dd1a979a37ba61b000830ff3a.zip
refactor(lua): reorganize builtin modules, phase 1
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua36
1 files changed, 34 insertions, 2 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 7ec986acdd..e66e08d9d0 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -23,9 +23,9 @@ local mkdir_p = helpers.mkdir_p
local rmdir = helpers.rmdir
local write_file = helpers.write_file
-before_each(clear)
describe('lua stdlib', function()
+ before_each(clear)
-- İ: `tolower("İ")` is `i` which has length 1 while `İ` itself has
-- length 2 (in bytes).
-- Ⱥ: `tolower("Ⱥ")` is `ⱥ` which has length 2 while `Ⱥ` itself has
@@ -2534,9 +2534,39 @@ describe('lua stdlib', function()
end)
end)
+describe('lua: builtin modules', function()
+ local function do_tests()
+ eq(2, exec_lua[[return vim.tbl_count {x=1,y=2}]])
+ eq('{ 10, "spam" }', exec_lua[[return vim.inspect {10, 'spam'}]])
+ end
+
+ it('works', function()
+ clear()
+ do_tests()
+ end)
+
+ it('works when disabled', function()
+ clear('--luamod-dev')
+ do_tests()
+ end)
+
+ it('works without runtime', function()
+ clear{env={VIMRUNTIME='fixtures/a'}}
+ do_tests()
+ end)
+
+
+ it('does not work when disabled without runtime', function()
+ clear{args={'--luamod-dev'}, env={VIMRUNTIME='fixtures/a'}}
+ -- error checking could be better here. just check that --luamod-dev
+ -- does anything at all by breaking with missing runtime..
+ eq(nil, exec_lua[[return vim.tbl_count {x=1,y=2}]])
+ end)
+end)
+
describe('lua: require("mod") from packages', function()
before_each(function()
- command('set rtp+=test/functional/fixtures pp+=test/functional/fixtures')
+ clear('--cmd', 'set rtp+=test/functional/fixtures pp+=test/functional/fixtures')
end)
it('propagates syntax error', function()
@@ -2559,6 +2589,8 @@ describe('lua: require("mod") from packages', function()
end)
describe('vim.keymap', function()
+ before_each(clear)
+
it('can make a mapping', function()
eq(0, exec_lua [[
GlobalCount = 0