mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
build: enable lintlua for test/unit/ dir #26396
Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `test/unit/` directory. - TODO: only `test/functional/` remains unchecked. previous:45fe4d11ad
previous:517f0cc634
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
local platform = vim.uv.os_uname()
|
||||
local deps_install_dir = table.remove(_G.arg, 1)
|
||||
local subcommand = table.remove(_G.arg, 1)
|
||||
local suffix = (platform and platform.sysname:lower():find'windows') and '.dll' or '.so'
|
||||
package.path = deps_install_dir.."/share/lua/5.1/?.lua;"..deps_install_dir.."/share/lua/5.1/?/init.lua;"..package.path
|
||||
package.cpath = deps_install_dir.."/lib/lua/5.1/?"..suffix..";"..package.cpath;
|
||||
local suffix = (platform and platform.sysname:lower():find 'windows') and '.dll' or '.so'
|
||||
package.path = deps_install_dir
|
||||
.. '/share/lua/5.1/?.lua;'
|
||||
.. deps_install_dir
|
||||
.. '/share/lua/5.1/?/init.lua;'
|
||||
.. package.path
|
||||
package.cpath = deps_install_dir .. '/lib/lua/5.1/?' .. suffix .. ';' .. package.cpath
|
||||
|
||||
local uv = vim.uv
|
||||
|
||||
@@ -15,14 +19,14 @@ local system = {}
|
||||
package.loaded['system.core'] = system
|
||||
function system.monotime()
|
||||
uv.update_time()
|
||||
return uv.now()*1e-3
|
||||
return uv.now() * 1e-3
|
||||
end
|
||||
function system.gettime()
|
||||
local sec, usec = uv.gettimeofday()
|
||||
return sec+usec*1e-6
|
||||
return sec + usec * 1e-6
|
||||
end
|
||||
function system.sleep(sec)
|
||||
uv.sleep(sec*1e3)
|
||||
uv.sleep(sec * 1e3)
|
||||
end
|
||||
|
||||
local term = {}
|
||||
@@ -31,7 +35,7 @@ function term.isatty(_)
|
||||
return uv.guess_handle(1) == 'tty'
|
||||
end
|
||||
|
||||
local lfs = {_VERSION = 'fake'}
|
||||
local lfs = { _VERSION = 'fake' }
|
||||
package.loaded['lfs'] = lfs
|
||||
|
||||
function lfs.attributes(path, attr)
|
||||
@@ -39,9 +43,11 @@ function lfs.attributes(path, attr)
|
||||
if attr == 'mode' then
|
||||
return stat and stat.type or ''
|
||||
elseif attr == 'modification' then
|
||||
if not stat then return nil end
|
||||
if not stat then
|
||||
return nil
|
||||
end
|
||||
local mtime = stat.mtime
|
||||
return mtime.sec + mtime.nsec*1e-9
|
||||
return mtime.sec + mtime.nsec * 1e-9
|
||||
else
|
||||
error('not implemented')
|
||||
end
|
||||
@@ -74,9 +80,9 @@ function lfs.mkdir(dir)
|
||||
return uv.fs_mkdir(dir, 493) -- octal 755
|
||||
end
|
||||
|
||||
if subcommand == "busted" then
|
||||
if subcommand == 'busted' then
|
||||
require 'busted.runner'({ standalone = false })
|
||||
elseif subcommand == "luacheck" then
|
||||
elseif subcommand == 'luacheck' then
|
||||
require 'luacheck.main'
|
||||
else
|
||||
error 'unknown subcommand'
|
||||
|
Reference in New Issue
Block a user