mirror of
https://github.com/neovim/neovim.git
synced 2026-01-04 10:26:42 +10: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:45fe4d11adprevious:517f0cc634
This commit is contained in:
@@ -62,7 +62,7 @@ describe('env.c', function()
|
||||
eq('non-empty', os.getenv(name))
|
||||
end)
|
||||
|
||||
itp("`overwrite` behavior", function()
|
||||
itp('`overwrite` behavior', function()
|
||||
local name = 'NVIM_UNIT_TEST_SETENV_2N'
|
||||
local value = 'NVIM_UNIT_TEST_SETENV_2V'
|
||||
local value_updated = 'NVIM_UNIT_TEST_SETENV_2V_UPDATED'
|
||||
@@ -79,7 +79,7 @@ describe('env.c', function()
|
||||
itp('appends :/foo/bar to $PATH', function()
|
||||
local original_path = os.getenv('PATH')
|
||||
eq(true, cimp.os_setenv_append_path(to_cstr('/foo/bar/baz.exe')))
|
||||
eq(original_path..':/foo/bar', os.getenv('PATH'))
|
||||
eq(original_path .. ':/foo/bar', os.getenv('PATH'))
|
||||
end)
|
||||
|
||||
itp('avoids redundant separator when appending to $PATH #7377', function()
|
||||
@@ -166,7 +166,7 @@ describe('env.c', function()
|
||||
local test_value = 'NVIM_UNIT_TEST_GETENVNAME_AT_INDEX_1V'
|
||||
os_setenv(test_name, test_value, 1)
|
||||
local i = 0
|
||||
local names = { }
|
||||
local names = {}
|
||||
local found_name = false
|
||||
local name = cimp.os_getenvname_at_index(i)
|
||||
while name ~= NULL do
|
||||
@@ -245,7 +245,7 @@ describe('env.c', function()
|
||||
local input = '~/foo ~ foo'
|
||||
local homedir = cstr(255, '')
|
||||
cimp.expand_env_esc(to_cstr('~'), homedir, 255, false, true, NULL)
|
||||
local output_expected = ffi.string(homedir) .. "/foo ~ foo"
|
||||
local output_expected = ffi.string(homedir) .. '/foo ~ foo'
|
||||
local output = cstr(255, '')
|
||||
cimp.expand_env_esc(to_cstr(input), output, 255, false, true, NULL)
|
||||
eq(ffi.string(output), ffi.string(output_expected))
|
||||
@@ -256,7 +256,7 @@ describe('env.c', function()
|
||||
local dst = cstr(255, '')
|
||||
cimp.expand_env_esc(to_cstr('~'), dst, 255, false, true, NULL)
|
||||
local homedir = ffi.string(dst)
|
||||
local output_expected = homedir .. "/foo " .. homedir .. " foo"
|
||||
local output_expected = homedir .. '/foo ' .. homedir .. ' foo'
|
||||
local output = cstr(255, '')
|
||||
cimp.expand_env_esc(input, output, 255, false, false, NULL)
|
||||
eq(output_expected, ffi.string(output))
|
||||
@@ -267,8 +267,9 @@ describe('env.c', function()
|
||||
cimp.os_get_username(name_out, 100)
|
||||
local curuser = ffi.string(name_out)
|
||||
|
||||
local src = to_cstr("~"..curuser.."/Vcs/django-rest-framework/rest_framework/renderers.py")
|
||||
local dst = cstr(256, "~"..curuser)
|
||||
local src =
|
||||
to_cstr('~' .. curuser .. '/Vcs/django-rest-framework/rest_framework/renderers.py')
|
||||
local dst = cstr(256, '~' .. curuser)
|
||||
cimp.expand_env_esc(src, dst, 256, false, false, NULL)
|
||||
local len = string.len(ffi.string(dst))
|
||||
assert.True(len > 56)
|
||||
@@ -283,7 +284,7 @@ describe('env.c', function()
|
||||
cimp.expand_env_esc(input, output, 5, false, true, NULL)
|
||||
-- Make sure the first few characters are copied properly and that there is a
|
||||
-- terminating null character
|
||||
for i=0,3 do
|
||||
for i = 0, 3 do
|
||||
eq(input[i], output[i])
|
||||
end
|
||||
eq(0, output[4])
|
||||
@@ -304,7 +305,7 @@ describe('env.c', function()
|
||||
-- terminating null character
|
||||
-- expand_env_esc SHOULD NOT expand the variable if there is not enough space to
|
||||
-- contain the result
|
||||
for i=0,3 do
|
||||
for i = 0, 3 do
|
||||
eq(output[i], input[i])
|
||||
end
|
||||
eq(output[4], 0)
|
||||
|
||||
Reference in New Issue
Block a user