mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00

The 'lupa' python package provides a simple way to seamless integrate lua and python code. This commit replaces vroom by a python script that exposes the 'neovim' package to a lua state, and invokes busted to run functional tests. This is a temporary solution that will enable writing functional tests using lua/bused while a lua client library is not available. The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style syntax while also providing the customization power of a full programming language. Another reason is to use a single framework for unit/functional tests. Two other changes were performed in this commit: - Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now identified by "gcc/gcc-32". They will run unit/functional tests for both 64 and 32 bits. - Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
85 lines
1.6 KiB
Lua
85 lines
1.6 KiB
Lua
local function clear()
|
|
nvim_command('call BeforeEachTest()')
|
|
end
|
|
|
|
local function feed(...)
|
|
for _, v in ipairs({...}) do
|
|
nvim_feed(nvim_replace_termcodes(dedent(v)))
|
|
end
|
|
end
|
|
|
|
local function rawfeed(...)
|
|
for _, v in ipairs({...}) do
|
|
nvim_feed(dedent(v), 'nt')
|
|
end
|
|
end
|
|
|
|
local function insert(...)
|
|
nvim_feed('i', 'nt')
|
|
rawfeed(...)
|
|
nvim_feed(nvim_replace_termcodes('<ESC>'), 'nt')
|
|
end
|
|
|
|
local function execute(...)
|
|
for _, v in ipairs({...}) do
|
|
if v:sub(1, 1) ~= '/' then
|
|
-- not a search command, prefix with colon
|
|
nvim_feed(':', 'nt')
|
|
end
|
|
nvim_feed(v, 'nt')
|
|
nvim_feed(nvim_replace_termcodes('<CR>'), 'nt')
|
|
end
|
|
end
|
|
|
|
local function expect(contents, first, last, buffer_index)
|
|
return assert.are.same(dedent(contents),
|
|
buffer_slice(first, last, buffer_idx))
|
|
end
|
|
|
|
rawfeed([[:function BeforeEachTest()
|
|
set all&
|
|
redir => groups
|
|
silent augroup
|
|
redir END
|
|
for group in split(groups)
|
|
exe 'augroup '.group
|
|
autocmd!
|
|
augroup END
|
|
endfor
|
|
autocmd!
|
|
tabnew
|
|
let curbufnum = eval(bufnr('%'))
|
|
redir => buflist
|
|
silent ls!
|
|
redir END
|
|
let bufnums = []
|
|
for buf in split(buflist, '\n')
|
|
let bufnum = eval(split(buf, '[ u]')[0])
|
|
if bufnum != curbufnum
|
|
call add(bufnums, bufnum)
|
|
endif
|
|
endfor
|
|
if len(bufnums) > 0
|
|
exe 'silent bwipeout! '.join(bufnums, ' ')
|
|
endif
|
|
silent tabonly
|
|
for k in keys(g:)
|
|
exe 'unlet g:'.k
|
|
endfor
|
|
filetype plugin indent off
|
|
mapclear
|
|
mapclear!
|
|
abclear
|
|
comclear
|
|
endfunction
|
|
]])
|
|
|
|
return {
|
|
clear = clear,
|
|
rawfeed = rawfeed,
|
|
insert = insert,
|
|
feed = feed,
|
|
execute = execute,
|
|
expect = expect
|
|
}
|