blob: d3f56d8d1498f206909cd33f9e548234335c0d4a [file] [log] [blame]
Bram Moolenaard3f78dc2017-02-25 14:21:10 +01001" Test spell checking
Bram Moolenaar5bcc5a12019-08-06 22:48:02 +02002" Note: this file uses latin1 encoding, but is used with utf-8 encoding.
Bram Moolenaard3f78dc2017-02-25 14:21:10 +01003
Bram Moolenaarb46fecd2019-06-15 17:58:09 +02004source check.vim
5CheckFeature spell
Bram Moolenaard3f78dc2017-02-25 14:21:10 +01006
Bram Moolenaar7751d1d2019-10-18 20:37:08 +02007source screendump.vim
8
Bram Moolenaar1a0f2002017-07-28 15:38:10 +02009func TearDown()
10 set nospell
11 call delete('Xtest.aff')
12 call delete('Xtest.dic')
13 call delete('Xtest.latin1.add')
14 call delete('Xtest.latin1.add.spl')
15 call delete('Xtest.latin1.spl')
16 call delete('Xtest.latin1.sug')
zeertzjq288ed232022-07-04 11:03:07 +010017 " set 'encoding' to clear the word list
18 set encoding=utf-8
Bram Moolenaar1a0f2002017-07-28 15:38:10 +020019endfunc
20
Bram Moolenaard3f78dc2017-02-25 14:21:10 +010021func Test_wrap_search()
22 new
23 call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End'])
24 set spell wrapscan
25 normal ]s
26 call assert_equal('plong', expand('<cword>'))
27 normal ]s
28 call assert_equal('zpelling', expand('<cword>'))
29 normal ]s
30 call assert_equal('plong', expand('<cword>'))
31 bwipe!
32 set nospell
33endfunc
Bram Moolenaar5b276aa2017-04-22 23:49:52 +020034
Bram Moolenaarb73fa622017-12-21 20:27:47 +010035func Test_curswant()
36 new
37 call setline(1, ['Another plong line', 'abcdefghijklmnopq'])
38 set spell wrapscan
39 normal 0]s
40 call assert_equal('plong', expand('<cword>'))
41 normal j
42 call assert_equal(9, getcurpos()[2])
43 normal 0[s
44 call assert_equal('plong', expand('<cword>'))
45 normal j
46 call assert_equal(9, getcurpos()[2])
47
48 normal 0]S
49 call assert_equal('plong', expand('<cword>'))
50 normal j
51 call assert_equal(9, getcurpos()[2])
52 normal 0[S
53 call assert_equal('plong', expand('<cword>'))
54 normal j
55 call assert_equal(9, getcurpos()[2])
56
57 normal 1G0
58 call assert_equal('plong', spellbadword()[0])
59 normal j
60 call assert_equal(9, getcurpos()[2])
61
62 bwipe!
63 set nospell
64endfunc
65
Bram Moolenaar5b276aa2017-04-22 23:49:52 +020066func Test_z_equal_on_invalid_utf8_word()
67 split
68 set spell
69 call setline(1, "\xff")
70 norm z=
71 set nospell
72 bwipe!
73endfunc
Bram Moolenaar545cb792017-05-23 11:31:22 +020074
Bram Moolenaar156d3912022-06-18 14:09:08 +010075func Test_z_equal_on_single_character()
76 " this was decrementing the index below zero
77 new
78 norm a0\Ê
79 norm zW
80 norm z=
81
82 bwipe!
83endfunc
84
Bram Moolenaar872e4512018-07-20 23:36:26 +020085" Test spellbadword() with argument
86func Test_spellbadword()
87 set spell
88
89 call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +020090 call assert_equal(['another', 'caps'], 'A sentence. another sentence'->spellbadword())
Bram Moolenaar872e4512018-07-20 23:36:26 +020091
Bram Moolenaar362b44b2020-06-10 21:47:00 +020092 call assert_equal(['TheCamelWord', 'bad'], 'TheCamelWord asdf'->spellbadword())
93 set spelloptions=camel
94 call assert_equal(['asdf', 'bad'], 'TheCamelWord asdf'->spellbadword())
95 set spelloptions=
96
Bram Moolenaar872e4512018-07-20 23:36:26 +020097 set spelllang=en
98 call assert_equal(['', ''], spellbadword('centre'))
99 call assert_equal(['', ''], spellbadword('center'))
100 set spelllang=en_us
101 call assert_equal(['centre', 'local'], spellbadword('centre'))
102 call assert_equal(['', ''], spellbadword('center'))
103 set spelllang=en_gb
104 call assert_equal(['', ''], spellbadword('centre'))
105 call assert_equal(['center', 'local'], spellbadword('center'))
106
107 " Create a small word list to test that spellbadword('...')
108 " can return ['...', 'rare'].
109 e Xwords
110 insert
111foo
112foobar/?
113.
114 w!
115 mkspell! Xwords.spl Xwords
116 set spelllang=Xwords.spl
117 call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
118
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200119 " Typo should be detected even without the 'spell' option.
Bram Moolenaar872e4512018-07-20 23:36:26 +0200120 set spelllang=en_gb nospell
121 call assert_equal(['', ''], spellbadword('centre'))
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200122 call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
123 call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))
124
125 set spelllang=
126 call assert_fails("call spellbadword('maxch')", 'E756:')
Bram Moolenaar96fdf432020-09-11 18:11:50 +0200127 call assert_fails("spelldump", 'E756:')
Bram Moolenaar872e4512018-07-20 23:36:26 +0200128
129 call delete('Xwords.spl')
130 call delete('Xwords')
131 set spelllang&
132 set spell&
133endfunc
134
Bram Moolenaard569a9e2020-09-28 23:13:15 +0200135func Test_spell_file_missing()
136 let s:spell_file_missing = 0
137 augroup TestSpellFileMissing
138 autocmd! SpellFileMissing * let s:spell_file_missing += 1
139 augroup END
140
141 set spell spelllang=ab_cd
142 let messages = GetMessages()
143 call assert_equal('Warning: Cannot find word list "ab.utf-8.spl" or "ab.ascii.spl"', messages[-1])
144 call assert_equal(1, s:spell_file_missing)
145
146 new XTestSpellFileMissing
147 augroup TestSpellFileMissing
148 autocmd! SpellFileMissing * bwipe
149 augroup END
150 call assert_fails('set spell spelllang=ab_cd', 'E797:')
151
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100152 " clean up
153 augroup TestSpellFileMissing
154 autocmd! SpellFileMissing
155 augroup END
Bram Moolenaard569a9e2020-09-28 23:13:15 +0200156 augroup! TestSpellFileMissing
157 unlet s:spell_file_missing
158 set spell& spelllang&
159 %bwipe!
160endfunc
161
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200162func Test_spelldump()
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100163 " In case the spell file is not found avoid getting the download dialog, we
164 " would get stuck at the prompt.
165 let g:en_not_found = 0
166 augroup TestSpellFileMissing
167 au! SpellFileMissing * let g:en_not_found = 1
168 augroup END
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200169 set spell spelllang=en
170 spellrare! emacs
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100171 if g:en_not_found
172 call assert_report("Could not find English spell file")
173 else
174 spelldump
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200175
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100176 " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
177 call assert_equal('/regions=usaucagbnz', getline(1))
178 call assert_notequal(0, search('^theater/1$')) " US English only.
179 call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English.
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200180
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100181 call assert_notequal(0, search('^emacs/?$')) " ? for a rare word.
182 call assert_notequal(0, search('^the the/!$')) " ! for a wrong word.
183 endif
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200184
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100185 " clean up
186 unlet g:en_not_found
187 augroup TestSpellFileMissing
188 autocmd! SpellFileMissing
189 augroup END
190 augroup! TestSpellFileMissing
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200191 bwipe
192 set spell&
193endfunc
194
195func Test_spelldump_bang()
196 new
197 call setline(1, 'This is a sample sentence.')
198 redraw
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100199
200 " In case the spell file is not found avoid getting the download dialog, we
201 " would get stuck at the prompt.
202 let g:en_not_found = 0
203 augroup TestSpellFileMissing
204 au! SpellFileMissing * let g:en_not_found = 1
205 augroup END
206
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200207 set spell
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200208
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100209 if g:en_not_found
210 call assert_report("Could not find English spell file")
211 else
212 redraw
213 spelldump!
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200214
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100215 " :spelldump! includes the number of times a word was found while updating
216 " the screen.
217 " Common word count starts at 10, regular word count starts at 0.
218 call assert_notequal(0, search("^is\t11$")) " common word found once.
219 call assert_notequal(0, search("^the\t10$")) " common word never found.
220 call assert_notequal(0, search("^sample\t1$")) " regular word found once.
221 call assert_equal(0, search("^screen\t")) " regular word never found.
222 endif
223
224 " clean up
225 unlet g:en_not_found
226 augroup TestSpellFileMissing
227 autocmd! SpellFileMissing
228 augroup END
229 augroup! TestSpellFileMissing
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200230 %bwipe!
231 set spell&
232endfunc
233
Bram Moolenaar8c7ad362020-09-27 13:58:38 +0200234func Test_spelllang_inv_region()
235 set spell spelllang=en_xx
236 let messages = GetMessages()
237 call assert_equal('Warning: region xx not supported', messages[-1])
238 set spell& spelllang&
239endfunc
240
241func Test_compl_with_CTRL_X_CTRL_K_using_spell()
242 " When spell checking is enabled and 'dictionary' is empty,
243 " CTRL-X CTRL-K in insert mode completes using the spelling dictionary.
244 new
245 set spell spelllang=en dictionary=
246
247 set ignorecase
248 call feedkeys("Senglis\<c-x>\<c-k>\<esc>", 'tnx')
249 call assert_equal(['English'], getline(1, '$'))
250 call feedkeys("SEnglis\<c-x>\<c-k>\<esc>", 'tnx')
251 call assert_equal(['English'], getline(1, '$'))
252
253 set noignorecase
254 call feedkeys("Senglis\<c-x>\<c-k>\<esc>", 'tnx')
255 call assert_equal(['englis'], getline(1, '$'))
256 call feedkeys("SEnglis\<c-x>\<c-k>\<esc>", 'tnx')
257 call assert_equal(['English'], getline(1, '$'))
258
259 set spelllang=en_us
260 call feedkeys("Stheat\<c-x>\<c-k>\<esc>", 'tnx')
261 call assert_equal(['theater'], getline(1, '$'))
262 set spelllang=en_gb
263 call feedkeys("Stheat\<c-x>\<c-k>\<esc>", 'tnx')
264 " FIXME: commented out, expected theatre bug got theater. See issue #7025.
265 " call assert_equal(['theatre'], getline(1, '$'))
266
267 bwipe!
268 set spell& spelllang& dictionary& ignorecase&
269endfunc
270
Bram Moolenaar545cb792017-05-23 11:31:22 +0200271func Test_spellreall()
272 new
273 set spell
274 call assert_fails('spellrepall', 'E752:')
275 call setline(1, ['A speling mistake. The same speling mistake.',
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200276 \ 'Another speling mistake.'])
Bram Moolenaar545cb792017-05-23 11:31:22 +0200277 call feedkeys(']s1z=', 'tx')
278 call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
279 call assert_equal('Another speling mistake.', getline(2))
280 spellrepall
281 call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
282 call assert_equal('Another spelling mistake.', getline(2))
283 call assert_fails('spellrepall', 'E753:')
284 set spell&
285 bwipe!
286endfunc
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200287
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100288" Test spellsuggest({word} [, {max} [, {capital}]])
289func Test_spellsuggest()
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200290 " Verify suggestions are given even when spell checking is not enabled.
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100291 set nospell
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200292 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100293
294 set spell
295
296 " With 1 argument.
Bram Moolenaar76734052019-12-26 14:30:15 +0100297 call assert_equal(['march', 'March'], spellsuggest('marrch')[0:1])
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100298
299 " With 2 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100300 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100301
302 " With 3 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100303 call assert_equal(['march'], spellsuggest('marrch', 1, 0))
304 call assert_equal(['March'], spellsuggest('marrch', 1, 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100305
306 " Test with digits and hyphen.
307 call assert_equal('Carbon-14', spellsuggest('Carbon-15')[0])
308
309 " Comment taken from spellsuggest.c explains the following test cases:
310 "
311 " If there are more UPPER than lower case letters suggest an
312 " ALLCAP word. Otherwise, if the first letter is UPPER then
313 " suggest ONECAP. Exception: "ALl" most likely should be "All",
314 " require three upper case letters.
Bram Moolenaar76734052019-12-26 14:30:15 +0100315 call assert_equal(['THIRD', 'third'], spellsuggest('thIRD', 2))
316 call assert_equal(['third', 'THIRD'], spellsuggest('tHIrd', 2))
317 call assert_equal(['Third'], spellsuggest('THird', 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100318 call assert_equal(['All'], spellsuggest('ALl', 1))
319
Dominique Pellef645ee42021-12-05 13:21:18 +0000320 " Special suggestion for repeated 'the the'.
321 call assert_inrange(0, 2, index(spellsuggest('the the', 3), 'the'))
322 call assert_inrange(0, 2, index(spellsuggest('the the', 3), 'the'))
323 call assert_inrange(0, 2, index(spellsuggest('The the', 3), 'The'))
324
Bram Moolenaar0e05de42020-03-25 22:23:46 +0100325 call assert_fails("call spellsuggest('maxch', [])", 'E745:')
326 call assert_fails("call spellsuggest('maxch', 2, [])", 'E745:')
327
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200328 set spelllang=
329 call assert_fails("call spellsuggest('maxch')", 'E756:')
330 set spelllang&
331
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100332 set spell&
333endfunc
334
335" Test 'spellsuggest' option with methods fast, best and double.
336func Test_spellsuggest_option_methods()
337 set spell
338
Bram Moolenaar76734052019-12-26 14:30:15 +0100339 for e in ['latin1', 'utf-8']
340 exe 'set encoding=' .. e
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100341
Bram Moolenaar76734052019-12-26 14:30:15 +0100342 set spellsuggest=fast
343 call assert_equal(['Stick', 'Stitch'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100344
Bram Moolenaar76734052019-12-26 14:30:15 +0100345 " With best or double option, "Stitch" should become the top suggestion
346 " because of better phonetic matching.
347 set spellsuggest=best
348 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100349
Bram Moolenaar76734052019-12-26 14:30:15 +0100350 set spellsuggest=double
351 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
352 endfor
353
354 set spell& spellsuggest& encoding&
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100355endfunc
356
357" Test 'spellsuggest' option with value file:{filename}
358func Test_spellsuggest_option_file()
359 set spell spellsuggest=file:Xspellsuggest
360 call writefile(['emacs/vim',
361 \ 'theribal/terrible',
362 \ 'teribal/terrrible',
363 \ 'terribal'],
364 \ 'Xspellsuggest')
365
366 call assert_equal(['vim'], spellsuggest('emacs', 2))
367 call assert_equal(['terrible'], spellsuggest('theribal',2))
368
369 " If the suggestion is misspelled (*terrrible* with 3 r),
370 " it should not be proposed.
371 " The entry for "terribal" should be ignored because of missing slash.
372 call assert_equal([], spellsuggest('teribal', 2))
373 call assert_equal([], spellsuggest('terribal', 2))
374
375 set spell spellsuggest=best,file:Xspellsuggest
376 call assert_equal(['vim', 'Emacs'], spellsuggest('emacs', 2))
377 call assert_equal(['terrible', 'tribal'], spellsuggest('theribal', 2))
378 call assert_equal(['tribal'], spellsuggest('teribal', 1))
379 call assert_equal(['tribal'], spellsuggest('terribal', 1))
380
381 call delete('Xspellsuggest')
382 call assert_fails("call spellsuggest('vim')", "E484: Can't open file Xspellsuggest")
383
384 set spellsuggest& spell&
385endfunc
386
387" Test 'spellsuggest' option with value {number}
388" to limit the number of suggestions
389func Test_spellsuggest_option_number()
390 set spell spellsuggest=2,best
391 new
392
393 " We limited the number of suggestions to 2, so selecting
394 " the 1st and 2nd suggestion should correct the word, but
395 " selecting a 3rd suggestion should do nothing.
Bram Moolenaar76734052019-12-26 14:30:15 +0100396 call setline(1, 'A baord')
397 norm $1z=
398 call assert_equal('A board', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100399
Bram Moolenaar76734052019-12-26 14:30:15 +0100400 call setline(1, 'A baord')
401 norm $2z=
402 call assert_equal('A bard', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100403
Bram Moolenaar76734052019-12-26 14:30:15 +0100404 call setline(1, 'A baord')
405 norm $3z=
406 call assert_equal('A baord', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100407
Bram Moolenaar76734052019-12-26 14:30:15 +0100408 let a = execute('norm $z=')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100409 call assert_equal(
410 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100411 \ .. "Change \"baord\" to:\n"
412 \ .. " 1 \"board\"\n"
413 \ .. " 2 \"bard\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200414 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100415
416 set spell spellsuggest=0
Bram Moolenaar76734052019-12-26 14:30:15 +0100417 call assert_equal("\nSorry, no suggestions", execute('norm $z='))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100418
419 " Unlike z=, function spellsuggest(...) should not be affected by the
420 " max number of suggestions (2) set by the 'spellsuggest' option.
Bram Moolenaar76734052019-12-26 14:30:15 +0100421 call assert_equal(['board', 'bard', 'broad'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100422
423 set spellsuggest& spell&
424 bwipe!
425endfunc
426
427" Test 'spellsuggest' option with value expr:{expr}
428func Test_spellsuggest_option_expr()
429 " A silly 'spellsuggest' function which makes suggestions all uppercase
430 " and makes the score of each suggestion the length of the suggested word.
431 " So shorter suggestions are preferred.
432 func MySuggest()
433 let spellsuggest_save = &spellsuggest
Bram Moolenaar76734052019-12-26 14:30:15 +0100434 set spellsuggest=3,best
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100435 let result = map(spellsuggest(v:val, 3), "[toupper(v:val), len(v:val)]")
436 let &spellsuggest = spellsuggest_save
437 return result
438 endfunc
439
Bram Moolenaar76734052019-12-26 14:30:15 +0100440 set spell spellsuggest=expr:MySuggest()
441 call assert_equal(['BARD', 'BOARD', 'BROAD'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100442
443 new
Bram Moolenaar76734052019-12-26 14:30:15 +0100444 call setline(1, 'baord')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100445 let a = execute('norm z=')
446 call assert_equal(
447 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100448 \ .. "Change \"baord\" to:\n"
449 \ .. " 1 \"BARD\"\n"
450 \ .. " 2 \"BOARD\"\n"
451 \ .. " 3 \"BROAD\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200452 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100453
454 " With verbose, z= should show the score i.e. word length with
455 " our SpellSuggest() function.
456 set verbose=1
457 let a = execute('norm z=')
458 call assert_equal(
459 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100460 \ .. "Change \"baord\" to:\n"
461 \ .. " 1 \"BARD\" (4 - 0)\n"
462 \ .. " 2 \"BOARD\" (5 - 0)\n"
463 \ .. " 3 \"BROAD\" (5 - 0)\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200464 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100465
466 set spell& spellsuggest& verbose&
467 bwipe!
468endfunc
469
Dominique Pelle81b573d2022-03-22 21:14:55 +0000470" Test for 'spellsuggest' expr errors
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100471func Test_spellsuggest_expr_errors()
472 " 'spellsuggest'
473 func MySuggest()
474 return range(3)
475 endfunc
476 set spell spellsuggest=expr:MySuggest()
477 call assert_equal([], spellsuggest('baord', 3))
478
479 " Test for 'spellsuggest' expression returning a non-list value
480 func! MySuggest2()
481 return 'good'
482 endfunc
483 set spellsuggest=expr:MySuggest2()
484 call assert_equal([], spellsuggest('baord'))
485
486 " Test for 'spellsuggest' expression returning a list with dict values
487 func! MySuggest3()
488 return [[{}, {}]]
489 endfunc
490 set spellsuggest=expr:MySuggest3()
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200491 call assert_fails("call spellsuggest('baord')", 'E731:')
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100492
493 set nospell spellsuggest&
494 delfunc MySuggest
495 delfunc MySuggest2
496 delfunc MySuggest3
497endfunc
498
Bram Moolenaar585ee072022-01-29 11:22:17 +0000499func Test_spellsuggest_timeout()
500 set spellsuggest=timeout:30
501 set spellsuggest=timeout:-123
502 set spellsuggest=timeout:999999
503 call assert_fails('set spellsuggest=timeout', 'E474:')
504 call assert_fails('set spellsuggest=timeout:x', 'E474:')
505 call assert_fails('set spellsuggest=timeout:-x', 'E474:')
506 call assert_fails('set spellsuggest=timeout:--9', 'E474:')
507endfunc
508
Bram Moolenaar5c686172022-03-13 20:12:25 +0000509func Test_spellsuggest_visual_end_of_line()
510 let enc_save = &encoding
511 set encoding=iso8859
512
513 " This was reading beyond the end of the line.
514 norm R00000000000
515 sil norm 0
516 sil! norm i00000)
517 sil! norm i00000)
518 call feedkeys("\<CR>")
519 norm z=
520
521 let &encoding = enc_save
522endfunc
523
Bram Moolenaar9049b682018-08-31 22:26:53 +0200524func Test_spellinfo()
525 new
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200526 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
Bram Moolenaar9049b682018-08-31 22:26:53 +0200527
528 set enc=latin1 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200529 call assert_match("^\nfile: " .. runtime .. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200530
531 set enc=cp1250 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200532 call assert_match("^\nfile: " .. runtime .. "/spell/en.ascii.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200533
Bram Moolenaar30276f22019-01-24 17:59:39 +0100534 set enc=utf-8 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200535 call assert_match("^\nfile: " .. runtime .. "/spell/en.utf-8.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200536
537 set enc=latin1 spell spelllang=en_us,en_nz
538 call assert_match("^\n" .
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200539 \ "file: " .. runtime .. "/spell/en.latin1.spl\n" .
540 \ "file: " .. runtime.. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200541
542 set spell spelllang=
543 call assert_fails('spellinfo', 'E756:')
544
545 set nospell spelllang=en
546 call assert_fails('spellinfo', 'E756:')
547
Bram Moolenaar8f130ed2019-04-10 22:15:19 +0200548 call assert_fails('set spelllang=foo/bar', 'E474:')
549 call assert_fails('set spelllang=foo\ bar', 'E474:')
550 call assert_fails("set spelllang=foo\\\nbar", 'E474:')
551 call assert_fails("set spelllang=foo\\\rbar", 'E474:')
552 call assert_fails("set spelllang=foo+bar", 'E474:')
553
Bram Moolenaar9049b682018-08-31 22:26:53 +0200554 set enc& spell& spelllang&
555 bwipe
556endfunc
557
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200558func Test_zz_basic()
559 call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
560 call RunGoodBad("wrong OK puts. Test the end",
561 \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
562 \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
563 \ "test", "testen", "testn", "the end", "uk", "wrong"],
564 \[
565 \ ["bad", ["put", "uk", "OK"]],
566 \ ["inputs", ["input", "puts", "outputs"]],
567 \ ["comment", ["Comment", "outtest", "the end"]],
568 \ ["ok", ["OK", "uk", "put"]],
569 \ ["Ok", ["OK", "Uk", "Put"]],
570 \ ["test", ["Test", "testn", "testen"]],
571 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
572 \ ["end", ["put", "uk", "test"]],
573 \ ["the", ["put", "uk", "test"]],
574 \ ]
575 \ )
576
577 call assert_equal("gebletegek", soundfold('goobledygoook'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200578 call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200579 call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
580endfunc
581
582" Postponed prefixes
583func Test_zz_prefixes()
584 call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
585 call RunGoodBad("puts",
586 \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
587 \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
588 \ [
589 \ ["bad", ["put", "uk", "OK"]],
590 \ ["inputs", ["input", "puts", "outputs"]],
591 \ ["comment", ["Comment"]],
592 \ ["ok", ["OK", "uk", "put"]],
593 \ ["Ok", ["OK", "Uk", "Put"]],
594 \ ["end", ["put", "uk", "deol"]],
595 \ ["the", ["put", "uk", "test"]],
596 \ ["test", ["Test", "testn", "testen"]],
597 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
598 \ ])
599endfunc
600
601"Compound words
602func Test_zz_compound()
603 call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
604 call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
605 \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
606 \ ["foo", "m\xEF"],
607 \ [
608 \ ["bad", ["foo", "m\xEF"]],
609 \ ["bar", ["barfoo", "foobar", "foo"]],
610 \ ["la", ["m\xEF", "foo"]],
611 \ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
612 \ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
613 \ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
614 \ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
615 \ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
616 \ ["lala", []],
617 \ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
618 \ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
619 \ ["foola", ["foo", "foobar", "foofoo"]],
620 \ ["labar", ["barbar", "foobar"]],
621 \ ])
622
623 call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
624 call RunGoodBad("word util bork prebork start end wordutil wordutils pro-ok bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork tomato tomatotomato startend startword startwordword startwordend startwordwordend startwordwordwordend prebork preborkbork preborkborkbork nouword",
625 \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword",
626 \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
627 \ [
628 \ ["bad", ["end", "bork", "word"]],
629 \ ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
630 \ ["pro", ["bork", "word", "end"]],
631 \ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
632 \ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
633 \ ["endstart", ["end start", "start"]],
634 \ ["endend", ["end end", "end"]],
635 \ ["startstart", ["start start"]],
636 \ ["wordend", ["word end", "word", "wordword"]],
637 \ ["wordstart", ["word start", "bork start"]],
638 \ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
639 \ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
640 \ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
641 \ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
642 \ ["utilsbork", ["utilbork", "utils bork", "util bork"]],
643 \ ["startnouword", ["start nouword", "startword", "startborkword"]],
644 \ ])
645
646endfunc
647
648"Test affix flags with two characters
649func Test_zz_affix()
650 call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
651 call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend",
652 \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
653 \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
654 \ [
655 \ ["bad", ["bar", "end", "fooa1"]],
656 \ ["foo", ["fooa1", "fooa\xE9", "bar"]],
657 \ ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
658 \ ["prabar", ["prebar", "bar", "bar bar"]],
659 \ ["probarbirk", ["prebarbork"]],
660 \ ["middle", []],
661 \ ["startmiddle", ["startmiddleend", "startmiddlebar"]],
662 \ ["middleend", []],
663 \ ["endstart", ["end start", "start"]],
664 \ ["startprobar", ["startprebar", "start prebar", "startbar"]],
665 \ ["startnouend", ["start nouend", "startend"]],
666 \ ])
667
668 call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
669 call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend",
670 \ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
671 \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
672 \ [
673 \ ["bad", ["bar", "end", "lead"]],
674 \ ["mee", ["meea1", "meea\xE9", "bar"]],
675 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
676 \ ["prabar", ["prebar", "bar", "leadbar"]],
677 \ ["probarbirk", ["prebarbork"]],
678 \ ["middle", []],
679 \ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
680 \ ["middleend", []],
681 \ ["endlead", ["end lead", "lead", "end end"]],
682 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
683 \ ])
684
685 call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100686 call RunGoodBad("meea1 meezero meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200687 \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100688 \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "meezero", "prebar", "prebarmeat", "tail"],
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200689 \ [
690 \ ["bad", ["bar", "lead", "tail"]],
691 \ ["mee", ["meea1", "meea\xE9", "bar"]],
692 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
693 \ ["prabar", ["prebar", "bar", "leadbar"]],
694 \ ["probarmaat", ["prebarmeat"]],
695 \ ["middle", []],
696 \ ["leadmiddle", ["leadmiddlebar"]],
697 \ ["middletail", []],
698 \ ["taillead", ["tail lead", "tail"]],
699 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
700 \ ])
701endfunc
702
703func Test_zz_NOSLITSUGS()
704 call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
705 call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
706 \ ["bar", "faabar", "foo"],
707 \ [
708 \ ["bad", ["bar", "foo"]],
709 \ ["foobar", ["faabar", "foo bar", "bar"]],
710 \ ["barfoo", ["bar foo", "bar", "foo"]],
711 \ ])
712endfunc
713
714" Numbers
715func Test_zz_Numbers()
716 call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
717 call RunGoodBad("0b1011 0777 1234 0x01ff", "",
718 \ ["bar", "foo"],
719 \ [
720 \ ])
721endfunc
722
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +0100723" Affix flags
724func Test_zz_affix_flags()
725 call LoadAffAndDic(g:test_data_aff10, g:test_data_dic10)
726 call RunGoodBad("drink drinkable drinkables drinktable drinkabletable",
727 \ "bad: drinks drinkstable drinkablestable",
728 \ ["drink", "drinkable", "drinkables", "table"],
729 \ [['bad', []],
730 \ ['drinks', ['drink']],
731 \ ['drinkstable', ['drinktable', 'drinkable', 'drink table']],
732 \ ['drinkablestable', ['drinkabletable', 'drinkables table', 'drinkable table']],
733 \ ])
734endfunc
735
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200736function FirstSpellWord()
737 call feedkeys("/^start:\n", 'tx')
738 normal ]smm
739 let [str, a] = spellbadword()
740 return str
741endfunc
742
743function SecondSpellWord()
744 normal `m]s
745 let [str, a] = spellbadword()
746 return str
747endfunc
748
749"Test with SAL instead of SOFO items; test automatic reloading
750func Test_zz_sal_and_addition()
751 set enc=latin1
752 set spellfile=
Bram Moolenaar1a0f2002017-07-28 15:38:10 +0200753 call writefile(g:test_data_dic1, "Xtest.dic")
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200754 call writefile(g:test_data_aff_sal, "Xtest.aff")
755 mkspell! Xtest Xtest
756 set spl=Xtest.latin1.spl spell
757 call assert_equal('kbltykk', soundfold('goobledygoook'))
758 call assert_equal('kprnfn', soundfold('kóopërÿnôven'))
759 call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
760
761 "also use an addition file
762 call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add")
763 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
764
765 bwipe!
766 call setline(1, ["start: elequint test elekwint test elekwent asdf"])
767
768 set spellfile=Xtest.latin1.add
769 call assert_equal("elekwent", FirstSpellWord())
770
771 set spl=Xtest_us.latin1.spl
772 call assert_equal("elequint", FirstSpellWord())
773 call assert_equal("elekwint", SecondSpellWord())
774
775 set spl=Xtest_gb.latin1.spl
776 call assert_equal("elekwint", FirstSpellWord())
777 call assert_equal("elekwent", SecondSpellWord())
778
779 set spl=Xtest_nz.latin1.spl
780 call assert_equal("elequint", FirstSpellWord())
781 call assert_equal("elekwent", SecondSpellWord())
782
783 set spl=Xtest_ca.latin1.spl
784 call assert_equal("elequint", FirstSpellWord())
785 call assert_equal("elekwint", SecondSpellWord())
zeertzjq288ed232022-07-04 11:03:07 +0100786
787 bwipe!
788 set spellfile=
789 set spl&
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200790endfunc
791
Bram Moolenaar862f1e12019-04-10 22:33:41 +0200792func Test_spellfile_value()
793 set spellfile=Xdir/Xtest.latin1.add
794 set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
795endfunc
796
Bram Moolenaaree03b942017-10-27 00:57:05 +0200797func Test_region_error()
798 messages clear
799 call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add")
800 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
801 call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
802 call delete('Xtest.latin1.add')
803 call delete('Xtest.latin1.add.spl')
804endfunc
805
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200806" Check using z= in new buffer (crash fixed by patch 7.4a.028).
807func Test_zeq_crash()
808 new
809 set maxmem=512 spell
810 call feedkeys('iasdz=:\"', 'tx')
811
812 bwipe!
813endfunc
814
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200815" Check that z= works even when 'nospell' is set. This test uses one of the
816" tests in Test_spellsuggest_option_number() just to verify that z= basically
817" works and that "E756: Spell checking is not enabled" is not generated.
818func Test_zeq_nospell()
819 new
820 set nospell spellsuggest=1,best
821 call setline(1, 'A baord')
822 try
823 norm $1z=
824 call assert_equal('A board', getline(1))
825 catch
826 call assert_report("Caught exception: " . v:exception)
827 endtry
828 set spell& spellsuggest&
829 bwipe!
830endfunc
831
832" Check that "E756: Spell checking is not possible" is reported when z= is
833" executed and 'spelllang' is empty.
834func Test_zeq_no_spelllang()
835 new
836 set spelllang= spellsuggest=1,best
837 call setline(1, 'A baord')
838 call assert_fails('normal $1z=', 'E756:')
839 set spelllang& spellsuggest&
840 bwipe!
841endfunc
842
Bram Moolenaar5bcc5a12019-08-06 22:48:02 +0200843" Check handling a word longer than MAXWLEN.
844func Test_spell_long_word()
845 set enc=utf-8
846 new
847 call setline(1, "d\xCC\xB4\xCC\xBD\xCD\x88\xCD\x94a\xCC\xB5\xCD\x84\xCD\x84\xCC\xA8\xCD\x9Cr\xCC\xB5\xCC\x8E\xCD\x85\xCD\x85k\xCC\xB6\xCC\x89\xCC\x9D \xCC\xB6\xCC\x83\xCC\x8F\xCC\xA4\xCD\x8Ef\xCC\xB7\xCC\x81\xCC\x80\xCC\xA9\xCC\xB0\xCC\xAC\xCC\xA2\xCD\x95\xCD\x87\xCD\x8D\xCC\x9E\xCD\x99\xCC\xAD\xCC\xAB\xCC\x97\xCC\xBBo\xCC\xB6\xCC\x84\xCC\x95\xCC\x8C\xCC\x8B\xCD\x9B\xCD\x9C\xCC\xAFr\xCC\xB7\xCC\x94\xCD\x83\xCD\x97\xCC\x8C\xCC\x82\xCD\x82\xCD\x80\xCD\x91\xCC\x80\xCC\xBE\xCC\x82\xCC\x8F\xCC\xA3\xCD\x85\xCC\xAE\xCD\x8D\xCD\x99\xCC\xBC\xCC\xAB\xCC\xA7\xCD\x88c\xCC\xB7\xCD\x83\xCC\x84\xCD\x92\xCC\x86\xCC\x83\xCC\x88\xCC\x92\xCC\x94\xCC\xBE\xCC\x9D\xCC\xAF\xCC\x98\xCC\x9D\xCC\xBB\xCD\x8E\xCC\xBB\xCC\xB3\xCC\xA3\xCD\x8E\xCD\x99\xCC\xA5\xCC\xAD\xCC\x99\xCC\xB9\xCC\xAE\xCC\xA5\xCC\x9E\xCD\x88\xCC\xAE\xCC\x9E\xCC\xA9\xCC\x97\xCC\xBC\xCC\x99\xCC\xA5\xCD\x87\xCC\x97\xCD\x8E\xCD\x94\xCC\x99\xCC\x9D\xCC\x96\xCD\x94\xCC\xAB\xCC\xA7\xCC\xA5\xCC\x98\xCC\xBB\xCC\xAF\xCC\xABe\xCC\xB7\xCC\x8E\xCC\x82\xCD\x86\xCD\x9B\xCC\x94\xCD\x83\xCC\x85\xCD\x8A\xCD\x8C\xCC\x8B\xCD\x92\xCD\x91\xCC\x8F\xCC\x81\xCD\x95\xCC\xA2\xCC\xB9\xCC\xB2\xCD\x9C\xCC\xB1\xCC\xA6\xCC\xB3\xCC\xAF\xCC\xAE\xCC\x9C\xCD\x99s\xCC\xB8\xCC\x8C\xCC\x8E\xCC\x87\xCD\x81\xCD\x82\xCC\x86\xCD\x8C\xCD\x8C\xCC\x8B\xCC\x84\xCC\x8C\xCD\x84\xCD\x9B\xCD\x86\xCC\x93\xCD\x90\xCC\x85\xCC\x94\xCD\x98\xCD\x84\xCD\x92\xCD\x8B\xCC\x90\xCC\x83\xCC\x8F\xCD\x84\xCD\x81\xCD\x9B\xCC\x90\xCD\x81\xCC\x8F\xCC\xBD\xCC\x88\xCC\xBF\xCC\x88\xCC\x84\xCC\x8E\xCD\x99\xCD\x94\xCC\x99\xCD\x99\xCC\xB0\xCC\xA8\xCC\xA3\xCC\xA8\xCC\x96\xCC\x99\xCC\xAE\xCC\xBC\xCC\x99\xCD\x9A\xCC\xB2\xCC\xB1\xCC\x9F\xCC\xBB\xCC\xA6\xCD\x85\xCC\xAA\xCD\x89\xCC\x9D\xCC\x99\xCD\x96\xCC\xB1\xCC\xB1\xCC\x99\xCC\xA6\xCC\xA5\xCD\x95\xCC\xB2\xCC\xA0\xCD\x99 within")
848 set spell spelllang=en
849 redraw
850 redraw!
851 bwipe!
852 set nospell
853endfunc
854
Bram Moolenaar06f15412022-01-29 10:51:59 +0000855func Test_spellsuggest_too_deep()
856 " This was incrementing "depth" over MAXWLEN.
857 new
858 norm s000G00ý000000000000
859 sil norm ..vzG................vvzG0 v z=
860 bwipe!
861endfunc
862
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100863func Test_spell_good_word_invalid()
864 " This was adding a word with a 0x02 byte, which causes havoc.
865 enew
866 norm o0
867 sil! norm rzzWs00/
868 2
869 sil! norm VzGprzzW
870 sil! norm z=
871
872 bwipe!
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100873endfunc
874
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200875func LoadAffAndDic(aff_contents, dic_contents)
876 set enc=latin1
877 set spellfile=
878 call writefile(a:aff_contents, "Xtest.aff")
879 call writefile(a:dic_contents, "Xtest.dic")
880 " Generate a .spl file from a .dic and .aff file.
881 mkspell! Xtest Xtest
882 " use that spell file
883 set spl=Xtest.latin1.spl spell
884endfunc
885
886func ListWords()
887 spelldump
888 %yank
889 quit
890 return split(@", "\n")
891endfunc
892
893func TestGoodBadBase()
894 exe '1;/^good:'
895 normal 0f:]s
896 let prevbad = ''
897 let result = []
898 while 1
899 let [bad, a] = spellbadword()
900 if bad == '' || bad == prevbad || bad == 'badend'
901 break
902 endif
903 let prevbad = bad
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200904 let lst = bad->spellsuggest(3)
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200905 normal mm
906
907 call add(result, [bad, lst])
908 normal `m]s
909 endwhile
910 return result
911endfunc
912
913func RunGoodBad(good, bad, expected_words, expected_bad_words)
914 bwipe!
915 call setline(1, ["good: ", a:good, a:bad, " badend "])
916 let words = ListWords()
917 call assert_equal(a:expected_words, words[1:-1])
918 let bad_words = TestGoodBadBase()
919 call assert_equal(a:expected_bad_words, bad_words)
920 bwipe!
921endfunc
922
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200923func Test_spell_screendump()
924 CheckScreendump
925
926 let lines =<< trim END
927 call setline(1, [
928 \ "This is some text without any spell errors. Everything",
929 \ "should just be black, nothing wrong here.",
930 \ "",
931 \ "This line has a sepll error. and missing caps.",
932 \ "And and this is the the duplication.",
933 \ "with missing caps here.",
934 \ ])
935 set spell spelllang=en_nz
936 END
937 call writefile(lines, 'XtestSpell')
938 let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
939 call VerifyScreenDump(buf, 'Test_spell_1', {})
940
941 " clean up
942 call StopVimInTerminal(buf)
943 call delete('XtestSpell')
944endfunc
945
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200946let g:test_data_aff1 = [
947 \"SET ISO8859-1",
948 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
949 \"",
950 \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
951 \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
952 \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
953 \"",
954 \"SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xBF",
955 \"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
956 \"",
957 \"MIDWORD\t'-",
958 \"",
959 \"KEP =",
960 \"RAR ?",
961 \"BAD !",
962 \"",
963 \"PFX I N 1",
964 \"PFX I 0 in .",
965 \"",
966 \"PFX O Y 1",
967 \"PFX O 0 out .",
968 \"",
969 \"SFX S Y 2",
970 \"SFX S 0 s [^s]",
971 \"SFX S 0 es s",
972 \"",
973 \"SFX N N 3",
974 \"SFX N 0 en [^n]",
975 \"SFX N 0 nen n",
976 \"SFX N 0 n .",
977 \"",
978 \"REP 3",
979 \"REP g ch",
980 \"REP ch g",
981 \"REP svp s.v.p.",
982 \"",
983 \"MAP 9",
984 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
985 \"MAP e\xE8\xE9\xEA\xEB",
986 \"MAP i\xEC\xED\xEE\xEF",
987 \"MAP o\xF2\xF3\xF4\xF5\xF6",
988 \"MAP u\xF9\xFA\xFB\xFC",
989 \"MAP n\xF1",
990 \"MAP c\xE7",
991 \"MAP y\xFF\xFD",
992 \"MAP s\xDF",
993 \ ]
994let g:test_data_dic1 = [
995 \"123456",
996 \"test/NO",
997 \"# comment",
998 \"wrong",
999 \"Comment",
1000 \"OK",
1001 \"uk",
1002 \"put/ISO",
1003 \"the end",
1004 \"deol",
1005 \"d\xE9\xF4r",
1006 \ ]
1007let g:test_data_aff2 = [
1008 \"SET ISO8859-1",
1009 \"",
1010 \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
1011 \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
1012 \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
1013 \"",
1014 \"PFXPOSTPONE",
1015 \"",
1016 \"MIDWORD\t'-",
1017 \"",
1018 \"KEP =",
1019 \"RAR ?",
1020 \"BAD !",
1021 \"",
1022 \"PFX I N 1",
1023 \"PFX I 0 in .",
1024 \"",
1025 \"PFX O Y 1",
1026 \"PFX O 0 out [a-z]",
1027 \"",
1028 \"SFX S Y 2",
1029 \"SFX S 0 s [^s]",
1030 \"SFX S 0 es s",
1031 \"",
1032 \"SFX N N 3",
1033 \"SFX N 0 en [^n]",
1034 \"SFX N 0 nen n",
1035 \"SFX N 0 n .",
1036 \"",
1037 \"REP 3",
1038 \"REP g ch",
1039 \"REP ch g",
1040 \"REP svp s.v.p.",
1041 \"",
1042 \"MAP 9",
1043 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1044 \"MAP e\xE8\xE9\xEA\xEB",
1045 \"MAP i\xEC\xED\xEE\xEF",
1046 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1047 \"MAP u\xF9\xFA\xFB\xFC",
1048 \"MAP n\xF1",
1049 \"MAP c\xE7",
1050 \"MAP y\xFF\xFD",
1051 \"MAP s\xDF",
1052 \ ]
1053let g:test_data_aff3 = [
1054 \"SET ISO8859-1",
1055 \"",
1056 \"COMPOUNDMIN 3",
1057 \"COMPOUNDRULE m*",
1058 \"NEEDCOMPOUND x",
1059 \ ]
1060let g:test_data_dic3 = [
1061 \"1234",
1062 \"foo/m",
1063 \"bar/mx",
1064 \"m\xEF/m",
1065 \"la/mx",
1066 \ ]
1067let g:test_data_aff4 = [
1068 \"SET ISO8859-1",
1069 \"",
1070 \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
1071 \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
1072 \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
1073 \"",
1074 \"COMPOUNDRULE m+",
1075 \"COMPOUNDRULE sm*e",
1076 \"COMPOUNDRULE sm+",
1077 \"COMPOUNDMIN 3",
1078 \"COMPOUNDWORDMAX 3",
1079 \"COMPOUNDFORBIDFLAG t",
1080 \"",
1081 \"COMPOUNDSYLMAX 5",
1082 \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
1083 \"",
1084 \"MAP 9",
1085 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1086 \"MAP e\xE8\xE9\xEA\xEB",
1087 \"MAP i\xEC\xED\xEE\xEF",
1088 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1089 \"MAP u\xF9\xFA\xFB\xFC",
1090 \"MAP n\xF1",
1091 \"MAP c\xE7",
1092 \"MAP y\xFF\xFD",
1093 \"MAP s\xDF",
1094 \"",
1095 \"NEEDAFFIX x",
1096 \"",
1097 \"PFXPOSTPONE",
1098 \"",
1099 \"MIDWORD '-",
1100 \"",
1101 \"SFX q N 1",
1102 \"SFX q 0 -ok .",
1103 \"",
1104 \"SFX a Y 2",
1105 \"SFX a 0 s .",
1106 \"SFX a 0 ize/t .",
1107 \"",
1108 \"PFX p N 1",
1109 \"PFX p 0 pre .",
1110 \"",
1111 \"PFX P N 1",
1112 \"PFX P 0 nou .",
1113 \ ]
1114let g:test_data_dic4 = [
1115 \"1234",
1116 \"word/mP",
1117 \"util/am",
1118 \"pro/xq",
1119 \"tomato/m",
1120 \"bork/mp",
1121 \"start/s",
1122 \"end/e",
1123 \ ]
1124let g:test_data_aff5 = [
1125 \"SET ISO8859-1",
1126 \"",
1127 \"FLAG long",
1128 \"",
1129 \"NEEDAFFIX !!",
1130 \"",
1131 \"COMPOUNDRULE ssmm*ee",
1132 \"",
1133 \"NEEDCOMPOUND xx",
1134 \"COMPOUNDPERMITFLAG pp",
1135 \"",
1136 \"SFX 13 Y 1",
1137 \"SFX 13 0 bork .",
1138 \"",
1139 \"SFX a1 Y 1",
1140 \"SFX a1 0 a1 .",
1141 \"",
1142 \"SFX a\xE9 Y 1",
1143 \"SFX a\xE9 0 a\xE9 .",
1144 \"",
1145 \"PFX zz Y 1",
1146 \"PFX zz 0 pre/pp .",
1147 \"",
1148 \"PFX yy Y 1",
1149 \"PFX yy 0 nou .",
1150 \ ]
1151let g:test_data_dic5 = [
1152 \"1234",
1153 \"foo/a1a\xE9!!",
1154 \"bar/zz13ee",
1155 \"start/ss",
1156 \"end/eeyy",
1157 \"middle/mmxx",
1158 \ ]
1159let g:test_data_aff6 = [
1160 \"SET ISO8859-1",
1161 \"",
1162 \"FLAG caplong",
1163 \"",
1164 \"NEEDAFFIX A!",
1165 \"",
1166 \"COMPOUNDRULE sMm*Ee",
1167 \"",
1168 \"NEEDCOMPOUND Xx",
1169 \"",
1170 \"COMPOUNDPERMITFLAG p",
1171 \"",
1172 \"SFX N3 Y 1",
1173 \"SFX N3 0 bork .",
1174 \"",
1175 \"SFX A1 Y 1",
1176 \"SFX A1 0 a1 .",
1177 \"",
1178 \"SFX A\xE9 Y 1",
1179 \"SFX A\xE9 0 a\xE9 .",
1180 \"",
1181 \"PFX Zz Y 1",
1182 \"PFX Zz 0 pre/p .",
1183 \ ]
1184let g:test_data_dic6 = [
1185 \"1234",
1186 \"mee/A1A\xE9A!",
1187 \"bar/ZzN3Ee",
1188 \"lead/s",
1189 \"end/Ee",
1190 \"middle/MmXx",
1191 \ ]
1192let g:test_data_aff7 = [
1193 \"SET ISO8859-1",
1194 \"",
1195 \"FLAG num",
1196 \"",
1197 \"NEEDAFFIX 9999",
1198 \"",
1199 \"COMPOUNDRULE 2,77*123",
1200 \"",
1201 \"NEEDCOMPOUND 1",
1202 \"COMPOUNDPERMITFLAG 432",
1203 \"",
1204 \"SFX 61003 Y 1",
1205 \"SFX 61003 0 meat .",
1206 \"",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001207 \"SFX 0 Y 1",
1208 \"SFX 0 0 zero .",
1209 \"",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001210 \"SFX 391 Y 1",
1211 \"SFX 391 0 a1 .",
1212 \"",
1213 \"SFX 111 Y 1",
1214 \"SFX 111 0 a\xE9 .",
1215 \"",
1216 \"PFX 17 Y 1",
1217 \"PFX 17 0 pre/432 .",
1218 \ ]
1219let g:test_data_dic7 = [
1220 \"1234",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001221 \"mee/0,391,111,9999",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001222 \"bar/17,61003,123",
1223 \"lead/2",
1224 \"tail/123",
1225 \"middle/77,1",
1226 \ ]
1227let g:test_data_aff8 = [
1228 \"SET ISO8859-1",
1229 \"",
1230 \"NOSPLITSUGS",
1231 \ ]
1232let g:test_data_dic8 = [
1233 \"1234",
1234 \"foo",
1235 \"bar",
1236 \"faabar",
1237 \ ]
1238let g:test_data_aff9 = [
1239 \ ]
1240let g:test_data_dic9 = [
1241 \"1234",
1242 \"foo",
1243 \"bar",
1244 \ ]
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +01001245let g:test_data_aff10 = [
1246 \"COMPOUNDRULE se",
1247 \"COMPOUNDPERMITFLAG p",
1248 \"",
1249 \"SFX A Y 1",
1250 \"SFX A 0 able/Mp .",
1251 \"",
1252 \"SFX M Y 1",
1253 \"SFX M 0 s .",
1254 \ ]
1255let g:test_data_dic10 = [
1256 \"1234",
1257 \"drink/As",
1258 \"table/e",
1259 \ ]
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001260let g:test_data_aff_sal = [
1261 \"SET ISO8859-1",
1262 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1263 \"",
1264 \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
1265 \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
1266 \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
1267 \"",
1268 \"MIDWORD\t'-",
1269 \"",
1270 \"KEP =",
1271 \"RAR ?",
1272 \"BAD !",
1273 \"",
1274 \"PFX I N 1",
1275 \"PFX I 0 in .",
1276 \"",
1277 \"PFX O Y 1",
1278 \"PFX O 0 out .",
1279 \"",
1280 \"SFX S Y 2",
1281 \"SFX S 0 s [^s]",
1282 \"SFX S 0 es s",
1283 \"",
1284 \"SFX N N 3",
1285 \"SFX N 0 en [^n]",
1286 \"SFX N 0 nen n",
1287 \"SFX N 0 n .",
1288 \"",
1289 \"REP 3",
1290 \"REP g ch",
1291 \"REP ch g",
1292 \"REP svp s.v.p.",
1293 \"",
1294 \"MAP 9",
1295 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1296 \"MAP e\xE8\xE9\xEA\xEB",
1297 \"MAP i\xEC\xED\xEE\xEF",
1298 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1299 \"MAP u\xF9\xFA\xFB\xFC",
1300 \"MAP n\xF1",
1301 \"MAP c\xE7",
1302 \"MAP y\xFF\xFD",
1303 \"MAP s\xDF",
1304 \"",
1305 \"SAL AH(AEIOUY)-^ *H",
1306 \"SAL AR(AEIOUY)-^ *R",
1307 \"SAL A(HR)^ *",
1308 \"SAL A^ *",
1309 \"SAL AH(AEIOUY)- H",
1310 \"SAL AR(AEIOUY)- R",
1311 \"SAL A(HR) _",
1312 \"SAL \xC0^ *",
1313 \"SAL \xC5^ *",
1314 \"SAL BB- _",
1315 \"SAL B B",
1316 \"SAL CQ- _",
1317 \"SAL CIA X",
1318 \"SAL CH X",
1319 \"SAL C(EIY)- S",
1320 \"SAL CK K",
1321 \"SAL COUGH^ KF",
1322 \"SAL CC< C",
1323 \"SAL C K",
1324 \"SAL DG(EIY) K",
1325 \"SAL DD- _",
1326 \"SAL D T",
1327 \"SAL \xC9< E",
1328 \"SAL EH(AEIOUY)-^ *H",
1329 \"SAL ER(AEIOUY)-^ *R",
1330 \"SAL E(HR)^ *",
1331 \"SAL ENOUGH^$ *NF",
1332 \"SAL E^ *",
1333 \"SAL EH(AEIOUY)- H",
1334 \"SAL ER(AEIOUY)- R",
1335 \"SAL E(HR) _",
1336 \"SAL FF- _",
1337 \"SAL F F",
1338 \"SAL GN^ N",
1339 \"SAL GN$ N",
1340 \"SAL GNS$ NS",
1341 \"SAL GNED$ N",
1342 \"SAL GH(AEIOUY)- K",
1343 \"SAL GH _",
1344 \"SAL GG9 K",
1345 \"SAL G K",
1346 \"SAL H H",
1347 \"SAL IH(AEIOUY)-^ *H",
1348 \"SAL IR(AEIOUY)-^ *R",
1349 \"SAL I(HR)^ *",
1350 \"SAL I^ *",
1351 \"SAL ING6 N",
1352 \"SAL IH(AEIOUY)- H",
1353 \"SAL IR(AEIOUY)- R",
1354 \"SAL I(HR) _",
1355 \"SAL J K",
1356 \"SAL KN^ N",
1357 \"SAL KK- _",
1358 \"SAL K K",
1359 \"SAL LAUGH^ LF",
1360 \"SAL LL- _",
1361 \"SAL L L",
1362 \"SAL MB$ M",
1363 \"SAL MM M",
1364 \"SAL M M",
1365 \"SAL NN- _",
1366 \"SAL N N",
1367 \"SAL OH(AEIOUY)-^ *H",
1368 \"SAL OR(AEIOUY)-^ *R",
1369 \"SAL O(HR)^ *",
1370 \"SAL O^ *",
1371 \"SAL OH(AEIOUY)- H",
1372 \"SAL OR(AEIOUY)- R",
1373 \"SAL O(HR) _",
1374 \"SAL PH F",
1375 \"SAL PN^ N",
1376 \"SAL PP- _",
1377 \"SAL P P",
1378 \"SAL Q K",
1379 \"SAL RH^ R",
1380 \"SAL ROUGH^ RF",
1381 \"SAL RR- _",
1382 \"SAL R R",
1383 \"SAL SCH(EOU)- SK",
1384 \"SAL SC(IEY)- S",
1385 \"SAL SH X",
1386 \"SAL SI(AO)- X",
1387 \"SAL SS- _",
1388 \"SAL S S",
1389 \"SAL TI(AO)- X",
1390 \"SAL TH @",
1391 \"SAL TCH-- _",
1392 \"SAL TOUGH^ TF",
1393 \"SAL TT- _",
1394 \"SAL T T",
1395 \"SAL UH(AEIOUY)-^ *H",
1396 \"SAL UR(AEIOUY)-^ *R",
1397 \"SAL U(HR)^ *",
1398 \"SAL U^ *",
1399 \"SAL UH(AEIOUY)- H",
1400 \"SAL UR(AEIOUY)- R",
1401 \"SAL U(HR) _",
1402 \"SAL V^ W",
1403 \"SAL V F",
1404 \"SAL WR^ R",
1405 \"SAL WH^ W",
1406 \"SAL W(AEIOU)- W",
1407 \"SAL X^ S",
1408 \"SAL X KS",
1409 \"SAL Y(AEIOU)- Y",
1410 \"SAL ZZ- _",
1411 \"SAL Z S",
1412 \ ]
Bram Moolenaar0e05de42020-03-25 22:23:46 +01001413
1414" vim: shiftwidth=2 sts=2 expandtab