@@ -137,26 +137,45 @@ func Test_spell_file_missing()
137137 augroup END
138138 call assert_fails (' set spell spelllang=ab_cd' , ' E797:' )
139139
140+ " clean up
141+ augroup TestSpellFileMissing
142+ autocmd ! SpellFileMissing
143+ augroup END
140144 augroup ! TestSpellFileMissing
141145 unlet s: spell_file_missing
142146 set spell & spelllang &
143147 % bwipe!
144148endfunc
145149
146150func 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
147157 set spell spelllang = en
148158 spellrare ! emacs
159+ if g: en_not_found
160+ call assert_report (" Could not find English spell file" )
161+ else
162+ spelldump
149163
150- spelldump
151-
152- " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
153- call assert_equal (' /regions=usaucagbnz' , getline (1 ))
154- call assert_notequal (0 , search (' ^theater/1$' )) " US English only.
155- call assert_notequal (0 , search (' ^theatre/2345$' )) " AU, CA, GB or NZ English.
164+ " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
165+ call assert_equal (' /regions=usaucagbnz' , getline (1 ))
166+ call assert_notequal (0 , search (' ^theater/1$' )) " US English only.
167+ call assert_notequal (0 , search (' ^theatre/2345$' )) " AU, CA, GB or NZ English.
156168
157- call assert_notequal (0 , search (' ^emacs/?$' )) " ? for a rare word.
158- call assert_notequal (0 , search (' ^the the/!$' )) " ! for a wrong word.
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
159172
173+ " clean up
174+ unlet g: en_not_found
175+ augroup TestSpellFileMissing
176+ autocmd ! SpellFileMissing
177+ augroup END
178+ augroup ! TestSpellFileMissing
160179 bwipe
161180 set spell &
162181endfunc
@@ -165,18 +184,37 @@ func Test_spelldump_bang()
165184 new
166185 call setline (1 , ' This is a sample sentence.' )
167186 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+
168195 set spell
169- redraw
170- spelldump !
171196
172- " :spelldump! includes the number of times a word was found while updating
173- " the screen.
174- " Common word count starts at 10, regular word count starts at 0.
175- call assert_notequal (0 , search (" ^is\t 11$" )) " common word found once.
176- call assert_notequal (0 , search (" ^the\t 10$" )) " common word never found.
177- call assert_notequal (0 , search (" ^sample\t 1$" )) " regular word found once.
178- call assert_equal (0 , search (" ^screen\t " )) " regular word never found.
197+ if g: en_not_found
198+ call assert_report (" Could not find English spell file" )
199+ else
200+ redraw
201+ spelldump !
202+
203+ " :spelldump! includes the number of times a word was found while updating
204+ " the screen.
205+ " Common word count starts at 10, regular word count starts at 0.
206+ call assert_notequal (0 , search (" ^is\t 11$" )) " common word found once.
207+ call assert_notequal (0 , search (" ^the\t 10$" )) " common word never found.
208+ call assert_notequal (0 , search (" ^sample\t 1$" )) " regular word found once.
209+ call assert_equal (0 , search (" ^screen\t " )) " regular word never found.
210+ endif
179211
212+ " clean up
213+ unlet g: en_not_found
214+ augroup TestSpellFileMissing
215+ autocmd ! SpellFileMissing
216+ augroup END
217+ augroup ! TestSpellFileMissing
180218 % bwipe!
181219 set spell &
182220endfunc
0 commit comments