diff --git a/test/.luacheckrc b/test/.luacheckrc index 92e19d40e8..1c98d096a4 100644 --- a/test/.luacheckrc +++ b/test/.luacheckrc @@ -11,3 +11,6 @@ self = false -- Rerun tests only if their modification time changed. cache = true + +-- Ignore whitespace issues in converted Vim legacy tests. +files["functional/legacy"] = {ignore = { "611", "612", "613", "621" }} diff --git a/test/benchmark/bench_re_freeze_spec.lua b/test/benchmark/bench_re_freeze_spec.lua index a194b5f44c..53041b042b 100644 --- a/test/benchmark/bench_re_freeze_spec.lua +++ b/test/benchmark/bench_re_freeze_spec.lua @@ -15,12 +15,12 @@ local measure_cmd = local measure_script = [[ func! Measure(re, file, pattern, arg) let sstart=reltime() - + execute 'set re=' . a:re execute 'split' a:arg a:file call search(a:pattern, '', '', 10000) q! - + $put =printf('file: %s, re: %d, time: %s', a:file, a:re, reltimestr(reltime(sstart))) endfunc]] diff --git a/test/functional/autocmd/tabclose_spec.lua b/test/functional/autocmd/tabclose_spec.lua index 65182ad859..1431c69589 100644 --- a/test/functional/autocmd/tabclose_spec.lua +++ b/test/functional/autocmd/tabclose_spec.lua @@ -7,7 +7,7 @@ describe('TabClosed', function() it('matches when closing any tab', function() clear() nvim('command', 'au! TabClosed * echom "tabclosed:".expand("").":".expand("").":".tabpagenr()') - repeat + repeat nvim('command', 'tabnew') until nvim('eval', 'tabpagenr()') == 6 -- current tab is now 6 eq("\ntabclosed:6:6:5", nvim('command_output', 'tabclose')) -- close last 6, current tab is now 5 @@ -19,7 +19,7 @@ describe('TabClosed', function() describe('with NR as ', function() it('matches when closing a tab whose index is NR', function() nvim('command', 'au! TabClosed 2 echom "tabclosed:match"') - repeat + repeat nvim('command', 'tabnew') until nvim('eval', 'tabpagenr()') == 5 -- current tab is now 5 -- sanity check, we shouldn't match on tabs with numbers other than 2 diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua index ebe7c5492b..3fb54c2ee7 100644 --- a/test/functional/eval/msgpack_functions_spec.lua +++ b/test/functional/eval/msgpack_functions_spec.lua @@ -16,18 +16,18 @@ describe('msgpack*() functions', function() end) end - -- Regression test: msgpack_list_write was failing to write buffer with zero + -- Regression test: msgpack_list_write was failing to write buffer with zero -- length. obj_test('are able to dump and restore {"file": ""}', {{file=''}}) - -- Regression test: msgpack_list_write was failing to write buffer with NL at + -- Regression test: msgpack_list_write was failing to write buffer with NL at -- the end. obj_test('are able to dump and restore {0, "echo mpack"}', {{0, 'echo mpack'}}) obj_test('are able to dump and restore "Test\\n"', {'Test\n'}) - -- Regression test: msgpack_list_write was failing to write buffer with NL + -- Regression test: msgpack_list_write was failing to write buffer with NL -- inside. obj_test('are able to dump and restore "Test\\nTest 2"', {'Test\nTest 2'}) - -- Test that big objects (requirement: dump to something that is bigger then - -- IOSIZE) are also fine. This particular object is obtained by concatenating + -- Test that big objects (requirement: dump to something that is bigger then + -- IOSIZE) are also fine. This particular object is obtained by concatenating -- 5 identical shada files. local big_obj = { 1, 1436711454, 78, { diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua index 3e326d9460..0a4d701794 100644 --- a/test/functional/ex_cmds/append_spec.lua +++ b/test/functional/ex_cmds/append_spec.lua @@ -22,8 +22,8 @@ local cmdtest = function(cmd, prep, ret1) command(cmd .. '\nabc\ndef\n') eq(ret1, buffer_contents()) end) - -- Used to crash because this invokes history processing which uses - -- hist_char2type which after fdb68e35e4c729c7ed097d8ade1da29e5b3f4b31 + -- Used to crash because this invokes history processing which uses + -- hist_char2type which after fdb68e35e4c729c7ed097d8ade1da29e5b3f4b31 -- crashed. it(cmd .. 's' .. prep .. ' the current line by default when feeding', function() diff --git a/test/functional/ex_cmds/arg_spec.lua b/test/functional/ex_cmds/arg_spec.lua index e66dc62491..e11b90532f 100644 --- a/test/functional/ex_cmds/arg_spec.lua +++ b/test/functional/ex_cmds/arg_spec.lua @@ -4,7 +4,7 @@ local ok = helpers.ok local clear = helpers.clear describe(":argument", function() - before_each(function() + before_each(function() clear() end) diff --git a/test/functional/ex_cmds/edit_spec.lua b/test/functional/ex_cmds/edit_spec.lua index 9e197d7466..3cc5f5fb95 100644 --- a/test/functional/ex_cmds/edit_spec.lua +++ b/test/functional/ex_cmds/edit_spec.lua @@ -4,7 +4,7 @@ local ok = helpers.ok local clear = helpers.clear describe(":edit", function() - before_each(function() + before_each(function() clear() end) diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua index 716c1ebfb2..a218bb6633 100644 --- a/test/functional/ex_cmds/oldfiles_spec.lua +++ b/test/functional/ex_cmds/oldfiles_spec.lua @@ -65,7 +65,7 @@ describe(':browse oldfiles', function() -- Ensure nvim is out of "Press ENTER..." screen feed('') - + -- Ensure v:oldfiles isn't busted. Since things happen so fast, -- the ordering of v:oldfiles is unstable (it uses qsort() under-the-hood). -- Let's verify the contents and the length of v:oldfiles before moving on. diff --git a/test/functional/ex_cmds/quit_spec.lua b/test/functional/ex_cmds/quit_spec.lua index 016a607743..fe138a24c8 100644 --- a/test/functional/ex_cmds/quit_spec.lua +++ b/test/functional/ex_cmds/quit_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear describe(':qa', function() - before_each(function() + before_each(function() clear('--cmd', 'qa') end) diff --git a/test/functional/ex_cmds/recover_spec.lua b/test/functional/ex_cmds/recover_spec.lua index 0c97857180..af1296c94c 100644 --- a/test/functional/ex_cmds/recover_spec.lua +++ b/test/functional/ex_cmds/recover_spec.lua @@ -32,7 +32,7 @@ describe(':preserve', function() it("saves to custom 'directory' and (R)ecovers (issue #1836)", function() local testfile = 'testfile_recover_spec' - -- Note: `set swapfile` *must* go after `set directory`: otherwise it may + -- Note: `set swapfile` *must* go after `set directory`: otherwise it may -- attempt to create a swapfile in different directory. local init = [[ set directory^=]]..swapdir..[[// diff --git a/test/functional/ex_getln/history_spec.lua b/test/functional/ex_getln/history_spec.lua index c1d2ffda53..20f9cf06a2 100644 --- a/test/functional/ex_getln/history_spec.lua +++ b/test/functional/ex_getln/history_spec.lua @@ -6,7 +6,7 @@ describe('history support code', function() before_each(clear) it('correctly clears start of the history', function() - -- Regression test: check absense of the memory leak when clearing start of + -- Regression test: check absense of the memory leak when clearing start of -- the history using ex_getln.c/clr_history(). eq(1, funcs.histadd(':', 'foo')) eq(1, funcs.histdel(':')) @@ -14,7 +14,7 @@ describe('history support code', function() end) it('correctly clears end of the history', function() - -- Regression test: check absense of the memory leak when clearing end of + -- Regression test: check absense of the memory leak when clearing end of -- the history using ex_getln.c/clr_history(). meths.set_option('history', 1) eq(1, funcs.histadd(':', 'foo')) @@ -23,8 +23,8 @@ describe('history support code', function() end) it('correctly removes item from history', function() - -- Regression test: check that ex_getln.c/del_history_idx() correctly clears - -- history index after removing history entry. If it does not then deleting + -- Regression test: check that ex_getln.c/del_history_idx() correctly clears + -- history index after removing history entry. If it does not then deleting -- history will result in a double free. eq(1, funcs.histadd(':', 'foo')) eq(1, funcs.histadd(':', 'bar')) diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua index 5990942de6..3e1ab70daf 100644 --- a/test/functional/plugin/matchparen_spec.lua +++ b/test/functional/plugin/matchparen_spec.lua @@ -9,7 +9,7 @@ local eq = helpers.eq local reset = plugin_helpers.reset -describe('matchparen', function() +describe('matchparen', function() local screen before_each(function() diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua index 19f35571d7..2b6b26b433 100644 --- a/test/functional/shada/errors_spec.lua +++ b/test/functional/shada/errors_spec.lua @@ -17,9 +17,9 @@ describe('ShaDa error handling', function() clean() end) - -- Note: most of tests have additional items like sX, mX, rX. These are for - -- valgrind tests, to check for memory leaks (i.e. whether error handling code - -- does (not) forget to call ga_clear). Not needed for array-based items like + -- Note: most of tests have additional items like sX, mX, rX. These are for + -- valgrind tests, to check for memory leaks (i.e. whether error handling code + -- does (not) forget to call ga_clear). Not needed for array-based items like -- history because they are not using ad_ga. it('does not fail on empty file', function() @@ -69,15 +69,15 @@ describe('ShaDa error handling', function() end) it('fails on search pattern item with invalid byte', function() - -- 195 (== 0xC1) cannot start any valid messagepack entry (the only byte + -- 195 (== 0xC1) cannot start any valid messagepack entry (the only byte -- that cannot do this). Specifically unpack_template.h contains -- -- //case 0xc1: // string -- // again_terminal_trail(NEXT_CS(p), p+1); -- - -- (literally: commented out code) which means that in place of this code - -- `goto _failed` is used from default: case. I do not know any other way to - -- get MSGPACK_UNPACK_PARSE_ERROR and not MSGPACK_UNPACK_CONTINUE or + -- (literally: commented out code) which means that in place of this code + -- `goto _failed` is used from default: case. I do not know any other way to + -- get MSGPACK_UNPACK_PARSE_ERROR and not MSGPACK_UNPACK_CONTINUE or -- MSGPACK_UNPACK_EXTRA_BYTES. wshada('\002\000\001\193') eq('Vim(rshada):E576: Failed to parse ShaDa file due to a msgpack parser error at position 3', exc_exec(sdrcmd())) diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index 05d8cda8e3..b7c0f61f57 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -194,8 +194,8 @@ describe('ShaDa support code', function() reset() nvim_command('edit ' .. testfilename) nvim_command('normal! Gg;') - -- Note: without “sync” “commands” test has good changes to fail for unknown - -- reason (in first eq expected 1 is compared with 2). Any command inserted + -- Note: without “sync” “commands” test has good changes to fail for unknown + -- reason (in first eq expected 1 is compared with 2). Any command inserted -- causes this to work properly. nvim_command('" sync') eq(1, nvim_current_line()) diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua index a420462437..f817bcef74 100644 --- a/test/functional/shada/variables_spec.lua +++ b/test/functional/shada/variables_spec.lua @@ -33,7 +33,7 @@ describe('ShaDa support code', function() else meths.set_var(varname, varval) end - -- Exit during `reset` is not a regular exit: it does not write shada + -- Exit during `reset` is not a regular exit: it does not write shada -- automatically nvim_command('qall') reset() diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua index 1936f70b82..8edcfa56b7 100644 --- a/test/functional/terminal/edit_spec.lua +++ b/test/functional/terminal/edit_spec.lua @@ -45,7 +45,7 @@ describe(':edit term://*', function() command('edit term://foobar') local bufcontents = {} local winheight = curwinmeths.get_height() - -- I have no idea why there is + 4 needed. But otherwise it works fine with + -- I have no idea why there is + 4 needed. But otherwise it works fine with -- different scrollbacks. local shift = -4 local buf_cont_start = rep_size - 1 - sb - winheight - shift diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 377f335c5c..0fe463401e 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -45,7 +45,7 @@ describe('terminal window highlighting', function() return str end - describe(title, function() + describe(title, function() before_each(function() set_attrs_fn() thelpers.feed_data('text') diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 2899925ed8..35aeb6e67c 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -1314,9 +1314,9 @@ describe("'inccommand' autocommands", function() before_each(clear) -- keys are events to be tested - -- values are arrays like - -- { open = { 1 }, close = { 2, 3} } - -- which would mean that during the test below the event fires for + -- values are arrays like + -- { open = { 1 }, close = { 2, 3} } + -- which would mean that during the test below the event fires for -- buffer 1 when opening the preview window, and for buffers 2 and 3 -- when closing the preview window local eventsExpected = { @@ -1385,7 +1385,7 @@ describe("'inccommand' autocommands", function() feed("/") for event, _ in pairs(eventsExpected) do - eventsObserved[event].close = meths.get_var(event .. "_fired") + eventsObserved[event].close = meths.get_var(event .. "_fired") end for event, _ in pairs(eventsExpected) do diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua index 58e3597233..ee3e4fa32a 100644 --- a/test/functional/ui/syntax_conceal_spec.lua +++ b/test/functional/ui/syntax_conceal_spec.lua @@ -6,9 +6,9 @@ local insert = helpers.insert if helpers.pending_win32(pending) then return end describe('Screen', function() - local screen + local screen - before_each(function() + before_each(function() clear() screen = Screen.new(nil,10) screen:attach() @@ -17,10 +17,10 @@ describe('Screen', function() [1] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray} } ) end) - + after_each(function() screen:detach() - end) + end) describe("match and conceal", function() @@ -56,7 +56,7 @@ describe('Screen', function() ]]) end) - it('double characters and move the cursor one line up.', function() + it('double characters and move the cursor one line up.', function() feed("k") screen:expect([[ {1:∧} | @@ -88,7 +88,7 @@ describe('Screen', function() ]]) end) - it('double characters and move the cursor to the second line in the file.', function() + it('double characters and move the cursor to the second line in the file.', function() feed("ggj") screen:expect([[ {1:∧} | @@ -104,7 +104,7 @@ describe('Screen', function() ]]) end) - it('double characters and then move the cursor to the beginning of the file and back to the end of the file.', function() + it('double characters and then move the cursor to the beginning of the file and back to the end of the file.', function() feed("ggG") screen:expect([[ {1:∧} | @@ -119,8 +119,8 @@ describe('Screen', function() :syn match dAmpersand '[&][&]' conceal cchar=∧ | ]]) end) - end) -- multiple - + end) -- multiple + it("keyword instances in initially in the document.", function() feed("2ilambda") execute("let &conceallevel=1") @@ -141,13 +141,13 @@ describe('Screen', function() describe("regions in the document", function() - before_each(function() + before_each(function() feed("2") insert(" a region of text \n") execute("let &conceallevel=1") end) - - it('initially and conceal it.', function() + + it('initially and conceal it.', function() execute("syn region rText start='' end='' conceal cchar=R") screen:expect([[ {1:R} | @@ -180,9 +180,9 @@ describe('Screen', function() | ]]) end) - + it('that are nested and conceal the nested region\'s start and end tags.', function() - execute("syn region rText contains=rText matchgroup=rMatch start='' end='' concealends cchar=-") + execute("syn region rText contains=rText matchgroup=rMatch start='' end='' concealends cchar=-") insert(" A region with a nested nested region. \n") screen:expect([[ {1: } a region of text {1:-} | @@ -200,8 +200,8 @@ describe('Screen', function() end) -- regions in the document describe("a region of text", function() - before_each(function() - execute("syntax conceal on") + before_each(function() + execute("syntax conceal on") feed("2") insert(" a region of text \n") execute("syn region rText start='' end='' cchar=-") @@ -257,17 +257,17 @@ describe('Screen', function() end) -- a region of text (implicit concealing) end) -- match and conceal - describe("let the conceal level be", function() + describe("let the conceal level be", function() before_each(function() - insert("// No Conceal\n") - insert('"Conceal without a cchar"\n') - insert("+ With cchar\n\n") + insert("// No Conceal\n") + insert('"Conceal without a cchar"\n') + insert("+ With cchar\n\n") execute("syn match noConceal '^//.*$'") execute("syn match concealNoCchar '\".\\{-}\"$' conceal") execute("syn match concealWCchar '^+.\\{-}$' conceal cchar=C") end) - - it("0. No concealing.", function() + + it("0. No concealing.", function() execute("let &conceallevel=0") screen:expect([[ // No Conceal | @@ -282,7 +282,7 @@ describe('Screen', function() :let &conceallevel=0 | ]]) end) - + it("1. Conceal using cchar or reference listchars.", function() execute("let &conceallevel=1") screen:expect([[ @@ -298,7 +298,7 @@ describe('Screen', function() :let &conceallevel=1 | ]]) end) - + it("2. Hidden unless cchar is set.", function() execute("let &conceallevel=2") screen:expect([[ @@ -314,8 +314,8 @@ describe('Screen', function() :let &conceallevel=2 | ]]) end) - - it("3. Hide all concealed text.", function() + + it("3. Hide all concealed text.", function() execute("let &conceallevel=3") screen:expect([[ // No Conceal | diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index da3400fb27..cd5f4260e0 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -526,7 +526,7 @@ describe('completion', function() | ]]) expect([[ - + June June]]) end) @@ -773,7 +773,7 @@ describe('completion', function() {3:-- Keyword completion (^N^P) }{4:match 2 of 2} | ]]) end) - + describe('from the commandline window', function() it('is cleared after CTRL-C', function () @@ -862,7 +862,7 @@ describe('External completion popupmenu', function() {1:~ }| {1:~ }| {2:-- INSERT --} | - ]], nil, nil, function() + ]], nil, nil, function() eq(expected, items) eq(0, selected) eq({1,0}, anchor) @@ -878,7 +878,7 @@ describe('External completion popupmenu', function() {1:~ }| {1:~ }| {2:-- INSERT --} | - ]], nil, nil, function() + ]], nil, nil, function() eq(expected, items) eq(-1, selected) eq({1,0}, anchor) diff --git a/test/unit/eval/decode_spec.lua b/test/unit/eval/decode_spec.lua index d94d809c14..742b754d8a 100644 --- a/test/unit/eval/decode_spec.lua +++ b/test/unit/eval/decode_spec.lua @@ -32,7 +32,7 @@ describe('json_decode_string()', function() it('does not overflow when running with `n…`, `t…`, `f…`', function() local rettv = ffi.new('typval_T', {v_type=decode.VAR_UNKNOWN}) decode.emsg_silent = 1 - -- This will not crash, but if `len` argument will be ignored it will parse + -- This will not crash, but if `len` argument will be ignored it will parse -- `null` as `null` and if not it will parse `null` as `n`. eq(0, decode.json_decode_string('null', 1, rettv)) eq(decode.VAR_UNKNOWN, rettv.v_type) diff --git a/test/unit/garray_spec.lua b/test/unit/garray_spec.lua index 9694e3c427..422ef7b36a 100644 --- a/test/unit/garray_spec.lua +++ b/test/unit/garray_spec.lua @@ -198,8 +198,8 @@ describe('garray', function() local function new_and_grow(itemsize_, growsize_, req) local garr = new_garray() ga_init(garr, itemsize_, growsize_) - eq(0, ga_size(garr)) -- should be 0 at first - eq(NULL, ga_data(garr)) -- should be NULL + eq(0, ga_size(garr)) -- should be 0 at first + eq(NULL, ga_data(garr)) -- should be NULL ga_grow(garr, req) -- add space for `req` items return garr end @@ -209,7 +209,7 @@ describe('garray', function() growsize = 4 local grow_by = growsize - 1 local garr = new_and_grow(itemsize, growsize, grow_by) - neq(NULL, ga_data(garr)) -- data should be a ptr to memory + neq(NULL, ga_data(garr)) -- data should be a ptr to memory eq(growsize, ga_maxlen(garr)) -- we requested LESS than growsize, so... end) @@ -218,7 +218,7 @@ describe('garray', function() growsize = 4 local grow_by = growsize + 1 local garr = new_and_grow(itemsize, growsize, grow_by) - neq(NULL, ga_data(garr)) -- data should be a ptr to memory + neq(NULL, ga_data(garr)) -- data should be a ptr to memory eq(grow_by, ga_maxlen(garr)) -- we requested MORE than growsize, so... end) diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 7e7eddb6fc..5d889d6e33 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -206,8 +206,8 @@ describe('fs function', function() lfs.chdir(directory) - -- Rely on currentdir to resolve symlinks, if any. Testing against - -- the absolute path taken from arg[0] may result in failure where + -- Rely on currentdir to resolve symlinks, if any. Testing against + -- the absolute path taken from arg[0] may result in failure where -- the path has a symlink in it. local canonical = lfs.currentdir() .. '/' .. executable_name local expected = exe(canonical) diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index 0034670ee8..072701ea78 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -13,7 +13,7 @@ describe('vim_strsave_escaped()', function() local res = strings.vim_strsave_escaped(to_cstr(s), to_cstr(chars)) local ret = ffi.string(res) - -- Explicitly free memory so we are sure it is allocated: if it was not it + -- Explicitly free memory so we are sure it is allocated: if it was not it -- will crash. strings.xfree(res) return ret @@ -44,7 +44,7 @@ describe('vim_strnsave_unquoted()', function() local vim_strnsave_unquoted = function(s, len) local res = strings.vim_strnsave_unquoted(to_cstr(s), len or #s) local ret = ffi.string(res) - -- Explicitly free memory so we are sure it is allocated: if it was not it + -- Explicitly free memory so we are sure it is allocated: if it was not it -- will crash. strings.xfree(res) return ret diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake index fee8dba207..9ea96b7cc5 100644 --- a/third-party/cmake/BuildLuarocks.cmake +++ b/third-party/cmake/BuildLuarocks.cmake @@ -144,7 +144,7 @@ if(USE_BUNDLED_BUSTED) add_custom_command(OUTPUT ${HOSTDEPS_BIN_DIR}/luacheck COMMAND ${LUAROCKS_BINARY} - ARGS build https://raw.githubusercontent.com/mpeterv/luacheck/3929eaa3528be2a8a50c593d687c8625205a2033/luacheck-scm-1.rockspec ${LUAROCKS_BUILDARGS} + ARGS build https://raw.githubusercontent.com/mpeterv/luacheck/master/luacheck-scm-1.rockspec ${LUAROCKS_BUILDARGS} DEPENDS busted) add_custom_target(luacheck DEPENDS ${HOSTDEPS_BIN_DIR}/luacheck)