mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-14 02:35:41 +08:00
test(flygrep): fix input_list test
This commit is contained in:
parent
1102e25686
commit
a1a3b5b817
@ -1,6 +1,17 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.getchar(...)
|
function M.getchar(...)
|
||||||
|
if vim.fn.empty(vim.g._spacevim_input_list) == 0 then
|
||||||
|
local input_list = vim.g._spacevim_input_list
|
||||||
|
local input_timeout = vim.g._spacevim_input_timeout or 0
|
||||||
|
if input_timeout > 0 then
|
||||||
|
vim.cmd('sleep ' .. input_timeout .. 'm')
|
||||||
|
end
|
||||||
|
local char = table.remove(input_list, 1)
|
||||||
|
vim.g._spacevim_input_list = input_list
|
||||||
|
return char
|
||||||
|
|
||||||
|
end
|
||||||
local status, ret = pcall(vim.fn.getchar, ...)
|
local status, ret = pcall(vim.fn.getchar, ...)
|
||||||
if not status then
|
if not status then
|
||||||
ret = 3
|
ret = 3
|
||||||
|
@ -7,11 +7,12 @@ Execute ( SpaceVim plugin: flygrep ):
|
|||||||
\ . ')'
|
\ . ')'
|
||||||
let g:_spacevim_input_timeout = 0
|
let g:_spacevim_input_timeout = 0
|
||||||
let lnr = 0
|
let lnr = 0
|
||||||
|
let current_line = line('.')
|
||||||
for line in readfile('Makefile')
|
for line in readfile('Makefile')
|
||||||
let lnr += 1
|
let lnr += 1
|
||||||
if line =~# 'COVIMERAGE'
|
if line =~# 'COVIMERAGE'
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
AssertEqual lnr, 4
|
AssertEqual lnr, current_line
|
||||||
unlet lnr line
|
unlet lnr line current_line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user