mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
test: Lua 5.2/5.3 compat #9280
Make the code run both on Lua 5.1 (which is the default for Neovim, and is what LuaJIT provides) and Lua 5.2+.
This commit is contained in:
committed by
Justin M. Keyes
parent
ccb005b9e0
commit
e6d0dea42b
@ -1,4 +1,5 @@
|
||||
local buf_hls = {}
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local function highlight_line(line, linenr)
|
||||
local chars = {}
|
||||
|
@ -2,6 +2,7 @@
|
||||
-- `rpcrequest` calls we need the client event loop to be running.
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Paths = require('test.config.paths')
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local clear, nvim, eval = helpers.clear, helpers.nvim, helpers.eval
|
||||
local eq, neq, run, stop = helpers.eq, helpers.neq, helpers.run, helpers.stop
|
||||
|
@ -8,6 +8,7 @@ local request = helpers.request
|
||||
local NIL = helpers.NIL
|
||||
local meth_pcall = helpers.meth_pcall
|
||||
local command = helpers.command
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
describe('api/tabpage', function()
|
||||
before_each(clear)
|
||||
|
@ -12,6 +12,7 @@ local meth_pcall = helpers.meth_pcall
|
||||
local meths = helpers.meths
|
||||
local command = helpers.command
|
||||
local expect_err = helpers.expect_err
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
-- check if str is visible at the beginning of some line
|
||||
local function is_visible(str)
|
||||
|
@ -1,4 +1,5 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local clear = helpers.clear
|
||||
local eq = helpers.eq
|
||||
|
@ -6,6 +6,7 @@ local iswin = helpers.iswin
|
||||
local ok = helpers.ok
|
||||
local matches = helpers.matches
|
||||
local expect_err = helpers.expect_err
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local function clear_serverlist()
|
||||
for _, server in pairs(funcs.serverlist()) do
|
||||
|
@ -4,6 +4,7 @@ local eq, next_msg = helpers.eq, helpers.next_msg
|
||||
local exc_exec = helpers.exc_exec
|
||||
local command = helpers.command
|
||||
local eval = helpers.eval
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
|
||||
describe('dictionary change notifications', function()
|
||||
|
@ -2,6 +2,7 @@ require('coxpcall')
|
||||
local luv = require('luv')
|
||||
local lfs = require('lfs')
|
||||
local global_helpers = require('test.helpers')
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
-- nvim client: Found in .deps/usr/share/lua/<version>/nvim/ if "bundled".
|
||||
local Session = require('nvim.session')
|
||||
|
@ -5,6 +5,7 @@ local curbuf, buf = helpers.curbuf, helpers.bufmeths
|
||||
local curwin = helpers.curwin
|
||||
local redir_exec = helpers.redir_exec
|
||||
local source, command = helpers.source, helpers.command
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local function declare_hook_function()
|
||||
source([[
|
||||
|
@ -78,6 +78,7 @@ local helpers = require('test.functional.helpers')(nil)
|
||||
local request, run, uimeths = helpers.request, helpers.run, helpers.uimeths
|
||||
local eq = helpers.eq
|
||||
local dedent = helpers.dedent
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local inspect = require('inspect')
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear, command, eq = helpers.clear, helpers.command, helpers.eq
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
describe('ui/ext_tabline', function()
|
||||
local screen
|
||||
|
@ -2,6 +2,7 @@ local assert = require('luassert')
|
||||
local luv = require('luv')
|
||||
local lfs = require('lfs')
|
||||
local relpath = require('pl.path').relpath
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local quote_me = '[^.%w%+%-%@%_%/]' -- complement (needn't quote)
|
||||
local function shell_quote(str)
|
||||
|
@ -2,6 +2,7 @@ local bit = require('bit')
|
||||
local helpers = require('test.unit.helpers')(after_each)
|
||||
local eval_helpers = require('test.unit.eval.helpers')
|
||||
local global_helpers = require('test.helpers')
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local itp = helpers.gen_itp(it)
|
||||
|
||||
|
@ -13,6 +13,7 @@ local garray = cimport('./src/nvim/garray.h')
|
||||
|
||||
local itemsize = 14
|
||||
local growsize = 95
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
-- define a basic interface to garray. We could make it a lot nicer by
|
||||
-- constructing a class wrapper around garray. It could for example associate
|
||||
|
@ -9,6 +9,7 @@ local say = require('say')
|
||||
|
||||
local posix = nil
|
||||
local syscall = nil
|
||||
local unpack = table.unpack or unpack -- luacheck: ignore
|
||||
|
||||
local check_cores = global_helpers.check_cores
|
||||
local dedent = global_helpers.dedent
|
||||
|
Reference in New Issue
Block a user