aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/tabpage_spec.lua1
-rw-r--r--test/functional/api/vim_spec.lua1
-rw-r--r--test/functional/autocmd/textyankpost_spec.lua2
-rw-r--r--test/functional/eval/json_functions_spec.lua1
-rw-r--r--test/functional/eval/special_vars_spec.lua4
-rw-r--r--test/functional/eval/string_spec.lua1
-rw-r--r--test/functional/ex_cmds/cd_spec.lua30
-rw-r--r--test/functional/helpers.lua4
-rw-r--r--test/functional/options/defaults_spec.lua5
-rw-r--r--test/functional/options/shortmess_spec.lua2
-rw-r--r--test/functional/plugin/msgpack_spec.lua1
11 files changed, 28 insertions, 24 deletions
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index 0f59bbea7b..c782107714 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -3,7 +3,6 @@ local helpers = require('test.functional.helpers')
local clear, nvim, tabpage, curtab, eq, ok =
helpers.clear, helpers.nvim, helpers.tabpage, helpers.curtab, helpers.eq,
helpers.ok
-local wait = helpers.wait
local curtabmeths = helpers.curtabmeths
local funcs = helpers.funcs
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 389badb423..20de6d0072 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,6 +1,7 @@
-- Sanity checks for vim_* API calls via msgpack-rpc
local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen')
+local NIL = helpers.NIL
local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
local os_name = helpers.os_name
diff --git a/test/functional/autocmd/textyankpost_spec.lua b/test/functional/autocmd/textyankpost_spec.lua
index 0e46aa5641..c26ceeaedc 100644
--- a/test/functional/autocmd/textyankpost_spec.lua
+++ b/test/functional/autocmd/textyankpost_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')
-local clear, eval, eq, insert = helpers.clear, helpers.eval, helpers.eq, helpers.insert
+local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
local feed, execute, expect, command = helpers.feed, helpers.execute, helpers.expect, helpers.command
local curbufmeths, funcs, neq = helpers.curbufmeths, helpers.funcs, helpers.neq
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 1cece78ce1..b32688a9d2 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -7,6 +7,7 @@ local eval = helpers.eval
local execute = helpers.execute
local exc_exec = helpers.exc_exec
local redir_exec = helpers.redir_exec
+local NIL = helpers.NIL
describe('json_decode() function', function()
local restart = function(cmd)
diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/eval/special_vars_spec.lua
index 6ab4e6a7d7..2526483830 100644
--- a/test/functional/eval/special_vars_spec.lua
+++ b/test/functional/eval/special_vars_spec.lua
@@ -1,12 +1,12 @@
local helpers = require('test.functional.helpers')
local exc_exec = helpers.exc_exec
local execute = helpers.execute
-local meths = helpers.meths
local funcs = helpers.funcs
-local meths = helpers.meths
local clear = helpers.clear
local eval = helpers.eval
local eq = helpers.eq
+local meths = helpers.meths
+local NIL = helpers.NIL
describe('Special values', function()
before_each(clear)
diff --git a/test/functional/eval/string_spec.lua b/test/functional/eval/string_spec.lua
index 0fd7587edb..abda2c59cb 100644
--- a/test/functional/eval/string_spec.lua
+++ b/test/functional/eval/string_spec.lua
@@ -8,6 +8,7 @@ local exc_exec = helpers.exc_exec
local redir_exec = helpers.redir_exec
local funcs = helpers.funcs
local write_file = helpers.write_file
+local NIL = helpers.NIL
describe('string() function', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index f5cce65104..b503eba46e 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')
local execute, eq, clear, eval, exc_exec =
helpers.execute, helpers.eq, helpers.clear, helpers.eval, helpers.exc_exec
-
+local lfs = require('lfs')
-- These directories will be created for testing
local directories = {
@@ -16,13 +16,13 @@ local directories = {
local cwd = function() return eval('getcwd( )') end -- effective working dir
local wcwd = function() return eval('getcwd( 0 )') end -- window dir
local tcwd = function() return eval('getcwd(-1, 0)') end -- tab dir
-local gcwd = function() return eval('getcwd(-1, -1)') end -- global dir
+--local gcwd = function() return eval('getcwd(-1, -1)') end -- global dir
-- Same, except these tell us if there is a working directory at all
-local lwd = function() return eval('haslocaldir( )') end -- effective working dir
+--local lwd = function() return eval('haslocaldir( )') end -- effective working dir
local wlwd = function() return eval('haslocaldir( 0 )') end -- window dir
local tlwd = function() return eval('haslocaldir(-1, 0)') end -- tab dir
-local glwd = function() return eval('haslocaldir(-1, -1)') end -- global dir
+--local glwd = function() return eval('haslocaldir(-1, -1)') end -- global dir
-- Test both the `cd` and `chdir` variants
for _, cmd in ipairs {'cd', 'chdir'} do
@@ -112,36 +112,36 @@ end
for _, cmd in ipairs {'getcwd', 'haslocaldir'} do
describe(cmd..'()', function()
-- Test invalid argument types
- local expected = 'Vim(call):E474: Invalid argument'
+ local err474 = 'Vim(call):E474: Invalid argument'
it('fails on string', function()
- eq(expected, exc_exec('call ' .. cmd .. '("some string")'))
+ eq(err474, exc_exec('call ' .. cmd .. '("some string")'))
end)
it('fails on float', function()
- eq(expected, exc_exec('call ' .. cmd .. '(1.0)'))
+ eq(err474, exc_exec('call ' .. cmd .. '(1.0)'))
end)
it('fails on list', function()
- eq(expected, exc_exec('call ' .. cmd .. '([1, 2])'))
+ eq(err474, exc_exec('call ' .. cmd .. '([1, 2])'))
end)
it('fails on dictionary', function()
- eq(expected, exc_exec('call ' .. cmd .. '({"key": "value"})'))
+ eq(err474, exc_exec('call ' .. cmd .. '({"key": "value"})'))
end)
it('fails on funcref', function()
- eq(expected, exc_exec('call ' .. cmd .. '(function("tr"))'))
+ eq(err474, exc_exec('call ' .. cmd .. '(function("tr"))'))
end)
-- Test invalid numbers
it('fails on number less than -1', function()
- eq(expected, exc_exec('call ' .. cmd .. '(-2)'))
+ eq(err474, exc_exec('call ' .. cmd .. '(-2)'))
end)
- local expected = 'Vim(call):E5001: Higher scope cannot be -1 if lower scope is >= 0.'
+ local err5001 = 'Vim(call):E5001: Higher scope cannot be -1 if lower scope is >= 0.'
it('fails on -1 if previous arg is >=0', function()
- eq(expected, exc_exec('call ' .. cmd .. '(0, -1)'))
+ eq(err5001, exc_exec('call ' .. cmd .. '(0, -1)'))
end)
-- Test wrong number of arguments
- local expected = 'Vim(call):E118: Too many arguments for function: ' .. cmd
+ local err118 = 'Vim(call):E118: Too many arguments for function: ' .. cmd
it('fails to parse more than one argument', function()
- eq(expected, exc_exec('call ' .. cmd .. '(0, 0, 0)'))
+ eq(err118, exc_exec('call ' .. cmd .. '(0, 0, 0)'))
end)
end)
end
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index a382641cff..6ccadda72d 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -1,5 +1,4 @@
require('coxpcall')
-NIL = require('mpack').NIL
local lfs = require('lfs')
local assert = require('luassert')
local ChildProcessStream = require('nvim.child_process_stream')
@@ -10,6 +9,8 @@ local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', 'set shortmess+=I background=light noswapfile noautoindent laststatus=1 undodir=. directory=. viewdir=. backupdir=.',
'--embed'}
+local mpack = require('mpack')
+
-- Formulate a path to the directory containing nvim. We use this to
-- help run test executables. It helps to keep the tests working, even
-- when the build is not in the default location.
@@ -452,4 +453,5 @@ return {
curbufmeths = curbufmeths,
curwinmeths = curwinmeths,
curtabmeths = curtabmeths,
+ NIL = mpack.NIL
}
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 7f0892ee3a..d4c3267997 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -1,8 +1,7 @@
local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen')
-local clear, feed = helpers.clear, helpers.feed
-local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq
-local execute, source, expect = helpers.execute, helpers.source, helpers.expect
+local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
+local execute = helpers.execute
local function init_session(...)
local args = { helpers.nvim_prog, '-i', 'NONE', '--embed',
diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua
index 04a64d2943..4455ef663f 100644
--- a/test/functional/options/shortmess_spec.lua
+++ b/test/functional/options/shortmess_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen')
-local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
+local clear, execute = helpers.clear, helpers.execute
describe("'shortmess'", function()
local screen
diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua
index 246b26188f..60ba88e55b 100644
--- a/test/functional/plugin/msgpack_spec.lua
+++ b/test/functional/plugin/msgpack_spec.lua
@@ -3,6 +3,7 @@ local meths = helpers.meths
local eq, nvim_eval, nvim_command, exc_exec =
helpers.eq, helpers.eval, helpers.command, helpers.exc_exec
local ok = helpers.ok
+local NIL = helpers.NIL
local plugin_helpers = require('test.functional.plugin.helpers')
local reset = plugin_helpers.reset