1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:10:06 +08:00

test(flygrep): add test for flygrep

This commit is contained in:
wsdjeg 2022-04-22 19:54:47 +08:00
parent ae6ecf01cf
commit ce699e7af7
2 changed files with 25 additions and 0 deletions

View File

@ -199,6 +199,10 @@ endfunction
if has('nvim')
function! s:self.getchar(...) abort
if !empty(get(g:, '_spacevim_input_list', []))
let input_timeout = get(g:, '_spacevim_input_timeout', 0)
if input_timeout > 0
exe printf('sleep %dm', input_timeout)
endif
return remove(g:_spacevim_input_list, 0)
endif
try
@ -211,6 +215,10 @@ if has('nvim')
else
function! s:self.getchar(...) abort
if !empty(get(g:, '_spacevim_input_list', []))
let input_timeout = get(g:, '_spacevim_input_timeout', 0)
if input_timeout > 0
exe printf('sleep %dm', input_timeout)
endif
return remove(g:_spacevim_input_list, 0)
endif
try

17
test/plugin/flygrep.vader Normal file
View File

@ -0,0 +1,17 @@
Execute ( SpaceVim plugin: flygrep ):
edit Makefile
let g:_spacevim_input_list = ["\<C-u>", 'C', 'O', 'V', 'I', 'M', 'E', 'R', 'A', 'G', 'E', "\<Enter>"]
let g:_spacevim_input_timeout = 400
exe 'call SpaceVim#plugins#flygrep#open('
\ . '{"input" : expand("<cword>"), "files": bufname("%")}'
\ . ')'
let g:_spacevim_input_timeout = 0
let lnr = 0
for line in readfile('Makefile')
let lnr += 1
if line =~# 'COVIMERAGE'
break
endif
endfor
AssertEqual lnr, 4
unlet lnr line