mirror of
https://github.com/neovim/neovim.git
synced 2025-11-04 17:54:30 +00:00
legacy tests: improvements to functional helpers.lua
- Clean vim registers and functions before each test - Add eval workaround to the request helper method - Export dedent method
This commit is contained in:
committed by
Thiago de Arruda
parent
1d250cddb8
commit
649aeceb38
@@ -67,6 +67,25 @@ local function restart()
|
|||||||
mapclear!
|
mapclear!
|
||||||
abclear
|
abclear
|
||||||
comclear
|
comclear
|
||||||
|
let regs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-"'
|
||||||
|
let i = 0
|
||||||
|
while i < strlen(regs)
|
||||||
|
call setreg(regs[i], '')
|
||||||
|
let i = i+1
|
||||||
|
endwhile
|
||||||
|
redir => funcs
|
||||||
|
silent! function
|
||||||
|
redir END
|
||||||
|
for fname in split(funcs, '\n')
|
||||||
|
let matches = matchlist(fname, '\v^function ([^()<>]+)')
|
||||||
|
if type([]) == type(matches) && matches[1] !~ 'BeforeEachTest'
|
||||||
|
exe 'silent! delfunc '.matches[1]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
let options = ['shell', 'fileignorecase']
|
||||||
|
for option in options
|
||||||
|
exe 'set '.option.'&'
|
||||||
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
@@ -83,6 +102,9 @@ local function request(method, ...)
|
|||||||
error(rv[2])
|
error(rv[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- Make sure this will only return after all buffered characters have been
|
||||||
|
-- processed
|
||||||
|
session:request('vim_eval', '1')
|
||||||
return rv
|
return rv
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -201,7 +223,6 @@ local function expect(contents, first, last, buffer_index)
|
|||||||
return eq(dedent(contents), buffer_slice(first, last, buffer_index))
|
return eq(dedent(contents), buffer_slice(first, last, buffer_index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function ok(expr)
|
local function ok(expr)
|
||||||
assert.is_true(expr)
|
assert.is_true(expr)
|
||||||
end
|
end
|
||||||
@@ -254,6 +275,7 @@ restart()
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
clear = clear,
|
clear = clear,
|
||||||
|
dedent = dedent,
|
||||||
restart = restart,
|
restart = restart,
|
||||||
rawfeed = rawfeed,
|
rawfeed = rawfeed,
|
||||||
insert = insert,
|
insert = insert,
|
||||||
|
|||||||
Reference in New Issue
Block a user