Skip to content

Commit

Permalink
patch 8.1.0045: popup test isn't run completely
Browse files Browse the repository at this point in the history
Problem:    Popup test isn't run completely.
Solution:   Remove "finish".  Clean up function definitions.
  • Loading branch information
brammool committed Jun 12, 2018
1 parent 8903676 commit ae0f30b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
54 changes: 25 additions & 29 deletions src/testdir/test_popup.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source screendump.vim
let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
let g:setting = '' let g:setting = ''


func! ListMonths() func ListMonths()
if g:setting != '' if g:setting != ''
exe ":set" g:setting exe ":set" g:setting
endif endif
Expand All @@ -19,7 +19,7 @@ func! ListMonths()
return '' return ''
endfunc endfunc


func! Test_popup_complete2() func Test_popup_complete2()
" Although the popupmenu is not visible, this does not mean completion mode " Although the popupmenu is not visible, this does not mean completion mode
" has ended. After pressing <f5> to complete the currently typed char, Vim " has ended. After pressing <f5> to complete the currently typed char, Vim
" still stays in the first state of the completion (:h ins-completion-menu), " still stays in the first state of the completion (:h ins-completion-menu),
Expand All @@ -34,9 +34,9 @@ func! Test_popup_complete2()
call assert_equal(["Dece", "", "December2015"], getline(1,3)) call assert_equal(["Dece", "", "December2015"], getline(1,3))
%d %d
bw! bw!
endfu endfunc


func! Test_popup_complete() func Test_popup_complete()
new new
inoremap <f5> <c-r>=ListMonths()<cr> inoremap <f5> <c-r>=ListMonths()<cr>
Expand Down Expand Up @@ -215,10 +215,10 @@ func! Test_popup_complete()
call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') call feedkeys("aM\<f5>\<enter>\<esc>", 'tx')
call assert_equal(["March", "M", "March"], getline(1,4)) call assert_equal(["March", "M", "March"], getline(1,4))
%d %d
endfu endfunc




func! Test_popup_completion_insertmode() func Test_popup_completion_insertmode()
new new
inoremap <F5> <C-R>=ListMonths()<CR> inoremap <F5> <C-R>=ListMonths()<CR>
Expand Down Expand Up @@ -247,20 +247,16 @@ func! Test_popup_completion_insertmode()
iunmap <F5> iunmap <F5>
endfunc endfunc


" TODO: Fix what breaks after this line.
" - Do not use "q!", it may exit Vim if there is an error
finish

func Test_noinsert_complete() func Test_noinsert_complete()
function! s:complTest1() abort func! s:complTest1() abort
call complete(1, ['source', 'soundfold']) call complete(1, ['source', 'soundfold'])
return '' return ''
endfunction endfunc


function! s:complTest2() abort func! s:complTest2() abort
call complete(1, ['source', 'soundfold']) call complete(1, ['source', 'soundfold'])
return '' return ''
endfunction endfunc


new new
set completeopt+=noinsert set completeopt+=noinsert
Expand All @@ -281,9 +277,9 @@ func Test_noinsert_complete()
endfunc endfunc


func Test_compl_vim_cmds_after_register_expr() func Test_compl_vim_cmds_after_register_expr()
function! s:test_func() func! s:test_func()
return 'autocmd ' return 'autocmd '
endfunction endfunc
augroup AAAAA_Group augroup AAAAA_Group
au! au!
augroup END augroup END
Expand Down Expand Up @@ -330,7 +326,7 @@ func DummyCompleteTwo(findstart, base)
else else
return ['twodef', 'twoDEF'] return ['twodef', 'twoDEF']
endif endif
endfunction endfunc


" Test that nothing happens if the 'completefunc' opens " Test that nothing happens if the 'completefunc' opens
" a new window (no completion, no crash) " a new window (no completion, no crash)
Expand Down Expand Up @@ -407,7 +403,7 @@ func Test_omnifunc_with_check()
q! q!
endfunc endfunc


function UndoComplete() func UndoComplete()
call complete(1, ['January', 'February', 'March', call complete(1, ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September', \ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December']) \ 'October', 'November', 'December'])
Expand Down Expand Up @@ -444,7 +440,7 @@ func Test_complete_no_undo()
q! q!
endfunc endfunc


function! DummyCompleteFive(findstart, base) func DummyCompleteFive(findstart, base)
if a:findstart if a:findstart
return 0 return 0
else else
Expand Down Expand Up @@ -489,7 +485,7 @@ func Test_completion_ctrl_e_without_autowrap()
q! q!
endfunc endfunc


function! DummyCompleteSix() func DummyCompleteSix()
call complete(1, ['Hello', 'World']) call complete(1, ['Hello', 'World'])
return '' return ''
endfunction endfunction
Expand Down Expand Up @@ -577,22 +573,22 @@ func Test_completion_comment_formatting()
bwipe! bwipe!
endfunc endfunc


fun MessCompleteMonths() func MessCompleteMonths()
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep") for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep")
call complete_add(m) call complete_add(m)
if complete_check() if complete_check()
break break
endif endif
endfor endfor
return [] return []
endfun endfunc


fun MessCompleteMore() func MessCompleteMore()
call complete(1, split("Oct Nov Dec")) call complete(1, split("Oct Nov Dec"))
return [] return []
endfun endfunc


fun MessComplete(findstart, base) func MessComplete(findstart, base)
if a:findstart if a:findstart
let line = getline('.') let line = getline('.')
let start = col('.') - 1 let start = col('.') - 1
Expand All @@ -605,7 +601,7 @@ fun MessComplete(findstart, base)
call MessCompleteMore() call MessCompleteMore()
return [] return []
endif endif
endf endfunc


func Test_complete_func_mess() func Test_complete_func_mess()
" Calling complete() after complete_add() in 'completefunc' is wrong, but it " Calling complete() after complete_add() in 'completefunc' is wrong, but it
Expand Down Expand Up @@ -835,15 +831,15 @@ func Test_popup_complete_backwards_ctrl_p()
bwipe! bwipe!
endfunc endfunc


fun! Test_complete_o_tab() func Test_complete_o_tab()
let s:o_char_pressed = 0 let s:o_char_pressed = 0


fun! s:act_on_text_changed() fun! s:act_on_text_changed()
if s:o_char_pressed if s:o_char_pressed
let s:o_char_pressed = 0 let s:o_char_pressed = 0
call feedkeys("\<c-x>\<c-n>", 'i') call feedkeys("\<c-x>\<c-n>", 'i')
endif endif
endf endfunc


set completeopt=menu,noselect set completeopt=menu,noselect
new new
Expand All @@ -862,7 +858,7 @@ fun! Test_complete_o_tab()
bwipe! bwipe!
set completeopt& set completeopt&
delfunc s:act_on_text_changed delfunc s:act_on_text_changed
endf endfunc




" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =


static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
45,
/**/ /**/
44, 44,
/**/ /**/
Expand Down

0 comments on commit ae0f30b

Please sign in to comment.