mirror of
https://github.com/neovim/neovim.git
synced 2025-12-26 16:19:15 +00:00
build: enable lintlua for test/ dir
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 stylua for entire `test/` directory. - Exclude these high-churn files until this issue is resolved: https://github.com/JohnnyMorganz/StyLua/issues/829 ``` test/functional/ui/decorations_spec.lua | 3560 ++++++++++++++++++++++++++++++++++++---------------- test/functional/ui/float_spec.lua | 5826 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------- test/functional/ui/multigrid_spec.lua | 1349 ++++++++++++++------ ``` - Make surgical changes to these files (or add `stylua: ignore` in some small scopes) to improve the result: ``` test/functional/vimscript/msgpack_functions_spec.lua | 1414 +++++++++++++++------ test/functional/api/buffer_spec.lua | 1389 +++++++++++---------- test/functional/api/vim_spec.lua | 2740 +++++++++++++++++++++++----------------- ``` - These "high churn" files are NOT excluded because the changes are largely an improvement: ``` test/functional/plugin/lsp_spec.lua | 2198 ++++++++++++++++++--------------- test/functional/plugin/shada_spec.lua | 4078 +++++++++++++++++++++++++++++++++++------------------------- test/functional/ui/cmdline_spec.lua | 1199 +++++++++++------- test/functional/ui/popupmenu_spec.lua | 1267 +++++++++++-------- test/functional/ui/messages_spec.lua | 1643 +++++++++++++++--------- ``` - TODO: how to check "all directories"? With `GLOB_DIRS *` and `/.deps/` (or `.deps/`) in `.styluaignore`, Lua code in `.deps/` is still checked...
This commit is contained in:
@@ -25,6 +25,7 @@ describe('spellfile', function()
|
||||
local spellheader = 'VIMspell\050'
|
||||
it('errors out when prefcond section is truncated', function()
|
||||
meths.set_option_value('runtimepath', testdir, {})
|
||||
-- stylua: ignore
|
||||
write_file(testdir .. '/spell/en.ascii.spl',
|
||||
-- ┌ Section identifier (#SN_PREFCOND)
|
||||
-- │ ┌ Section flags (#SNF_REQUIRED or zero)
|
||||
@@ -35,11 +36,11 @@ describe('spellfile', function()
|
||||
-- │ │ ┌ Condition regex (missing!)
|
||||
.. '\000\001\001')
|
||||
meths.set_option_value('spelllang', 'en', {})
|
||||
eq('Vim(set):E758: Truncated spell file',
|
||||
exc_exec('set spell'))
|
||||
eq('Vim(set):E758: Truncated spell file', exc_exec('set spell'))
|
||||
end)
|
||||
it('errors out when prefcond regexp contains NUL byte', function()
|
||||
meths.set_option_value('runtimepath', testdir, {})
|
||||
-- stylua: ignore
|
||||
write_file(testdir .. '/spell/en.ascii.spl',
|
||||
-- ┌ Section identifier (#SN_PREFCOND)
|
||||
-- │ ┌ Section flags (#SNF_REQUIRED or zero)
|
||||
@@ -55,11 +56,11 @@ describe('spellfile', function()
|
||||
-- │ │ ┌ PREFIXTREE tree length
|
||||
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
|
||||
meths.set_option_value('spelllang', 'en', {})
|
||||
eq('Vim(set):E759: Format error in spell file',
|
||||
exc_exec('set spell'))
|
||||
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
|
||||
end)
|
||||
it('errors out when region contains NUL byte', function()
|
||||
meths.set_option_value('runtimepath', testdir, {})
|
||||
-- stylua: ignore
|
||||
write_file(testdir .. '/spell/en.ascii.spl',
|
||||
-- ┌ Section identifier (#SN_REGION)
|
||||
-- │ ┌ Section flags (#SNF_REQUIRED or zero)
|
||||
@@ -72,11 +73,11 @@ describe('spellfile', function()
|
||||
-- │ │ ┌ PREFIXTREE tree length
|
||||
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
|
||||
meths.set_option_value('spelllang', 'en', {})
|
||||
eq('Vim(set):E759: Format error in spell file',
|
||||
exc_exec('set spell'))
|
||||
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
|
||||
end)
|
||||
it('errors out when SAL section contains NUL byte', function()
|
||||
meths.set_option_value('runtimepath', testdir, {})
|
||||
-- stylua: ignore
|
||||
write_file(testdir .. '/spell/en.ascii.spl',
|
||||
-- ┌ Section identifier (#SN_SAL)
|
||||
-- │ ┌ Section flags (#SNF_REQUIRED or zero)
|
||||
@@ -96,15 +97,12 @@ describe('spellfile', function()
|
||||
-- │ │ ┌ PREFIXTREE tree length
|
||||
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
|
||||
meths.set_option_value('spelllang', 'en', {})
|
||||
eq('Vim(set):E759: Format error in spell file',
|
||||
exc_exec('set spell'))
|
||||
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
|
||||
end)
|
||||
it('errors out when spell header contains NUL bytes', function()
|
||||
meths.set_option_value('runtimepath', testdir, {})
|
||||
write_file(testdir .. '/spell/en.ascii.spl',
|
||||
spellheader:sub(1, -3) .. '\000\000')
|
||||
write_file(testdir .. '/spell/en.ascii.spl', spellheader:sub(1, -3) .. '\000\000')
|
||||
meths.set_option_value('spelllang', 'en', {})
|
||||
eq('Vim(set):E757: This does not look like a spell file',
|
||||
exc_exec('set spell'))
|
||||
eq('Vim(set):E757: This does not look like a spell file', exc_exec('set spell'))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user