1
0
forked from aniani/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.
This commit is contained in:
Bram Moolenaar
2022-06-15 16:57:44 +01:00
parent 74ac29cecd
commit fc9f0fd6d1
2 changed files with 57 additions and 17 deletions

View File

@@ -137,6 +137,10 @@ func Test_spell_file_missing()
augroup END
call assert_fails('set spell spelllang=ab_cd', 'E797:')
" clean up
augroup TestSpellFileMissing
autocmd! SpellFileMissing
augroup END
augroup! TestSpellFileMissing
unlet s:spell_file_missing
set spell& spelllang&
@@ -144,9 +148,17 @@ func Test_spell_file_missing()
endfunc
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
spellrare! emacs
if g:en_not_found
call assert_report("Could not find English spell file")
else
spelldump
" Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
@@ -156,7 +168,14 @@ func Test_spelldump()
call assert_notequal(0, search('^emacs/?$')) " ? for a rare 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
set spell&
endfunc
@@ -165,7 +184,19 @@ func Test_spelldump_bang()
new
call setline(1, 'This is a sample sentence.')
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
if g:en_not_found
call assert_report("Could not find English spell file")
else
redraw
spelldump!
@@ -176,7 +207,14 @@ func Test_spelldump_bang()
call assert_notequal(0, search("^the\t10$")) " common word never found.
call assert_notequal(0, search("^sample\t1$")) " regular word found once.
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!
set spell&
endfunc

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5098,
/**/
5097,
/**/