vim-patch:8.2.5098: spelldump test sometimes hangs

Problem:    Spelldump test sometimes hangs.
Solution:   Catch the problem of the spell file not being found to avoid
            hanging in the download dialog.
fc9f0fd6d1
This commit is contained in:
zeertzjq
2022-07-04 18:37:42 +08:00
parent d9c63507f8
commit 08aba02ad7

View File

@@ -149,6 +149,10 @@ func Test_spell_file_missing()
augroup END augroup END
call assert_fails('set spell spelllang=ab_cd', 'E797:') call assert_fails('set spell spelllang=ab_cd', 'E797:')
" clean up
augroup TestSpellFileMissing
autocmd! SpellFileMissing
augroup END
augroup! TestSpellFileMissing augroup! TestSpellFileMissing
unlet s:spell_file_missing unlet s:spell_file_missing
set spell& spelllang& set spell& spelllang&
@@ -156,9 +160,17 @@ func Test_spell_file_missing()
endfunc endfunc
func Test_spelldump() func Test_spelldump()
" In case the spell file is not found avoid getting the download dialog, we
" would get stuck at the prompt.
let g:en_not_found = 0
augroup TestSpellFileMissing
au! SpellFileMissing * let g:en_not_found = 1
augroup END
set spell spelllang=en set spell spelllang=en
spellrare! emacs spellrare! emacs
if g:en_not_found
call assert_report("Could not find English spell file")
else
spelldump spelldump
" Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz. " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
@@ -168,7 +180,14 @@ func Test_spelldump()
call assert_notequal(0, search('^emacs/?$')) " ? for a rare word. call assert_notequal(0, search('^emacs/?$')) " ? for a rare word.
call assert_notequal(0, search('^the the/!$')) " ! for a wrong word. call assert_notequal(0, search('^the the/!$')) " ! for a wrong word.
endif
" clean up
unlet g:en_not_found
augroup TestSpellFileMissing
autocmd! SpellFileMissing
augroup END
augroup! TestSpellFileMissing
bwipe bwipe
set spell& set spell&
endfunc endfunc
@@ -177,7 +196,19 @@ func Test_spelldump_bang()
new new
call setline(1, 'This is a sample sentence.') call setline(1, 'This is a sample sentence.')
redraw redraw
" In case the spell file is not found avoid getting the download dialog, we
" would get stuck at the prompt.
let g:en_not_found = 0
augroup TestSpellFileMissing
au! SpellFileMissing * let g:en_not_found = 1
augroup END
set spell set spell
if g:en_not_found
call assert_report("Could not find English spell file")
else
redraw redraw
spelldump! spelldump!
@@ -188,7 +219,14 @@ func Test_spelldump_bang()
call assert_notequal(0, search("^the\t10$")) " common word never found. call assert_notequal(0, search("^the\t10$")) " common word never found.
call assert_notequal(0, search("^sample\t1$")) " regular word found once. call assert_notequal(0, search("^sample\t1$")) " regular word found once.
call assert_equal(0, search("^screen\t")) " regular word never found. call assert_equal(0, search("^screen\t")) " regular word never found.
endif
" clean up
unlet g:en_not_found
augroup TestSpellFileMissing
autocmd! SpellFileMissing
augroup END
augroup! TestSpellFileMissing
%bwipe! %bwipe!
set spell& set spell&
endfunc endfunc