comparison src/testdir/test_spell.vim @ 29157:a3564c0c9e06 v8.2.5098

patch 8.2.5098: spelldump test sometimes hangs Commit: https://github.com/vim/vim/commit/fc9f0fd6d18c03d6420f84ebb374a373c830fbad Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 15 16:57:44 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 15 Jun 2022 18:00:03 +0200
parents c01f75e5ae8d
children b8dc0a76911e
comparison
equal deleted inserted replaced
29156:b4839a29996e 29157:a3564c0c9e06
135 augroup TestSpellFileMissing 135 augroup TestSpellFileMissing
136 autocmd! SpellFileMissing * bwipe 136 autocmd! SpellFileMissing * bwipe
137 augroup END 137 augroup END
138 call assert_fails('set spell spelllang=ab_cd', 'E797:') 138 call assert_fails('set spell spelllang=ab_cd', 'E797:')
139 139
140 " clean up
141 augroup TestSpellFileMissing
142 autocmd! SpellFileMissing
143 augroup END
140 augroup! TestSpellFileMissing 144 augroup! TestSpellFileMissing
141 unlet s:spell_file_missing 145 unlet s:spell_file_missing
142 set spell& spelllang& 146 set spell& spelllang&
143 %bwipe! 147 %bwipe!
144 endfunc 148 endfunc
145 149
146 func Test_spelldump() 150 func Test_spelldump()
151 " In case the spell file is not found avoid getting the download dialog, we
152 " would get stuck at the prompt.
153 let g:en_not_found = 0
154 augroup TestSpellFileMissing
155 au! SpellFileMissing * let g:en_not_found = 1
156 augroup END
147 set spell spelllang=en 157 set spell spelllang=en
148 spellrare! emacs 158 spellrare! emacs
149 159 if g:en_not_found
150 spelldump 160 call assert_report("Could not find English spell file")
151 161 else
152 " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz. 162 spelldump
153 call assert_equal('/regions=usaucagbnz', getline(1)) 163
154 call assert_notequal(0, search('^theater/1$')) " US English only. 164 " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
155 call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English. 165 call assert_equal('/regions=usaucagbnz', getline(1))
156 166 call assert_notequal(0, search('^theater/1$')) " US English only.
157 call assert_notequal(0, search('^emacs/?$')) " ? for a rare word. 167 call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English.
158 call assert_notequal(0, search('^the the/!$')) " ! for a wrong word. 168
159 169 call assert_notequal(0, search('^emacs/?$')) " ? for a rare word.
170 call assert_notequal(0, search('^the the/!$')) " ! for a wrong word.
171 endif
172
173 " clean up
174 unlet g:en_not_found
175 augroup TestSpellFileMissing
176 autocmd! SpellFileMissing
177 augroup END
178 augroup! TestSpellFileMissing
160 bwipe 179 bwipe
161 set spell& 180 set spell&
162 endfunc 181 endfunc
163 182
164 func Test_spelldump_bang() 183 func Test_spelldump_bang()
165 new 184 new
166 call setline(1, 'This is a sample sentence.') 185 call setline(1, 'This is a sample sentence.')
167 redraw 186 redraw
187
188 " In case the spell file is not found avoid getting the download dialog, we
189 " would get stuck at the prompt.
190 let g:en_not_found = 0
191 augroup TestSpellFileMissing
192 au! SpellFileMissing * let g:en_not_found = 1
193 augroup END
194
168 set spell 195 set spell
169 redraw 196
170 spelldump! 197 if g:en_not_found
171 198 call assert_report("Could not find English spell file")
172 " :spelldump! includes the number of times a word was found while updating 199 else
173 " the screen. 200 redraw
174 " Common word count starts at 10, regular word count starts at 0. 201 spelldump!
175 call assert_notequal(0, search("^is\t11$")) " common word found once. 202
176 call assert_notequal(0, search("^the\t10$")) " common word never found. 203 " :spelldump! includes the number of times a word was found while updating
177 call assert_notequal(0, search("^sample\t1$")) " regular word found once. 204 " the screen.
178 call assert_equal(0, search("^screen\t")) " regular word never found. 205 " Common word count starts at 10, regular word count starts at 0.
179 206 call assert_notequal(0, search("^is\t11$")) " common word found once.
207 call assert_notequal(0, search("^the\t10$")) " common word never found.
208 call assert_notequal(0, search("^sample\t1$")) " regular word found once.
209 call assert_equal(0, search("^screen\t")) " regular word never found.
210 endif
211
212 " clean up
213 unlet g:en_not_found
214 augroup TestSpellFileMissing
215 autocmd! SpellFileMissing
216 augroup END
217 augroup! TestSpellFileMissing
180 %bwipe! 218 %bwipe!
181 set spell& 219 set spell&
182 endfunc 220 endfunc
183 221
184 func Test_spelllang_inv_region() 222 func Test_spelllang_inv_region()