1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

test(flygrep): fix input_list test

This commit is contained in:
wsdjeg 2023-08-09 03:43:53 +08:00
parent 1102e25686
commit a1a3b5b817
2 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,17 @@
local M = {}
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, ...)
if not status then
ret = 3

View File

@ -7,11 +7,12 @@ Execute ( SpaceVim plugin: flygrep ):
\ . ')'
let g:_spacevim_input_timeout = 0
let lnr = 0
let current_line = line('.')
for line in readfile('Makefile')
let lnr += 1
if line =~# 'COVIMERAGE'
break
endif
endfor
AssertEqual lnr, 4
unlet lnr line
AssertEqual lnr, current_line
unlet lnr line current_line