build: Target luacheck HEAD.

https://github.com/mpeterv/luacheck/pull/81#issuecomment-261099606

> If you really want to use bleeding-edge version you should get the
> rockspec from master branch, not a fixed commit ...
> The correct way to install from a specific commit is cloning that
> commit and running "luarocks make" from project directory. The reason
> is that running "install" or "build" on an scm rockspec fetches
> sources from master but uses build description from the rockspec
> itself, which may be outdated.
This commit is contained in:
Justin M. Keyes 2016-11-17 00:33:45 +01:00
parent 5e241b5f50
commit 44e6ee930f
25 changed files with 80 additions and 77 deletions

View File

@ -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" }}

View File

@ -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]]

View File

@ -7,7 +7,7 @@ describe('TabClosed', function()
it('matches when closing any tab', function()
clear()
nvim('command', 'au! TabClosed * echom "tabclosed:".expand("<afile>").":".expand("<amatch>").":".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 <afile>', 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

View File

@ -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, {

View File

@ -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()

View File

@ -4,7 +4,7 @@ local ok = helpers.ok
local clear = helpers.clear
describe(":argument", function()
before_each(function()
before_each(function()
clear()
end)

View File

@ -4,7 +4,7 @@ local ok = helpers.ok
local clear = helpers.clear
describe(":edit", function()
before_each(function()
before_each(function()
clear()
end)

View File

@ -65,7 +65,7 @@ describe(':browse oldfiles', function()
-- Ensure nvim is out of "Press ENTER..." screen
feed('<cr>')
-- 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.

View File

@ -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)

View File

@ -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..[[//

View File

@ -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'))

View File

@ -9,7 +9,7 @@ local eq = helpers.eq
local reset = plugin_helpers.reset
describe('matchparen', function()
describe('matchparen', function()
local screen
before_each(function()

View File

@ -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()))

View File

@ -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())

View File

@ -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()

View File

@ -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

View File

@ -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')

View File

@ -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("/<enter>")
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

View File

@ -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<cr><ESC>")
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("<r> a region of text </r>\n")
execute("let &conceallevel=1")
end)
it('initially and conceal it.', function()
it('initially and conceal it.', function()
execute("syn region rText start='<r>' end='</r>' 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='<r>' end='</r>' concealends cchar=-")
execute("syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
insert("<r> A region with <r> a nested <r> nested region.</r> </r> </r>\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("<r> a region of text </r>\n")
execute("syn region rText start='<r>' end='</r>' 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 |

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)