diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-04 18:37:42 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-04 18:37:46 +0800 |
commit | 08aba02ad7646e4a21ba3dfe63dbaf3c58f75406 (patch) | |
tree | ce40060168f7e2c3dcc53f95bb9f9189d73f8fc3 | |
parent | d9c63507f89c616df21d6f840fedce3431c53f16 (diff) | |
download | rneovim-08aba02ad7646e4a21ba3dfe63dbaf3c58f75406.tar.gz rneovim-08aba02ad7646e4a21ba3dfe63dbaf3c58f75406.tar.bz2 rneovim-08aba02ad7646e4a21ba3dfe63dbaf3c58f75406.zip |
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.
https://github.com/vim/vim/commit/fc9f0fd6d18c03d6420f84ebb374a373c830fbad
-rw-r--r-- | src/nvim/testdir/test_spell.vim | 72 |
1 files changed, 55 insertions, 17 deletions
diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim index 61e000c8da..f3aaf43100 100644 --- a/src/nvim/testdir/test_spell.vim +++ b/src/nvim/testdir/test_spell.vim @@ -149,6 +149,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& @@ -156,19 +160,34 @@ 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 - spelldump - - " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz. - call assert_equal('/regions=usaucagbnz', getline(1)) - call assert_notequal(0, search('^theater/1$')) " US English only. - call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English. + " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz. + call assert_equal('/regions=usaucagbnz', getline(1)) + call assert_notequal(0, search('^theater/1$')) " US English only. + call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English. - 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('^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 @@ -177,18 +196,37 @@ 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 - redraw - spelldump! - " :spelldump! includes the number of times a word was found while updating - " the screen. - " Common word count starts at 10, regular word count starts at 0. - call assert_notequal(0, search("^is\t11$")) " common word found once. - 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. + if g:en_not_found + call assert_report("Could not find English spell file") + else + redraw + spelldump! + + " :spelldump! includes the number of times a word was found while updating + " the screen. + " Common word count starts at 10, regular word count starts at 0. + call assert_notequal(0, search("^is\t11$")) " common word found once. + 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 |