blob: bd387f11d22109be2a066ccf3cb87413849cbd39 [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
Bram Moolenaar371951d2022-09-28 14:08:23 +0100150 call assert_fails('set spell spelllang=ab_cd', 'E937:')
Bram Moolenaard569a9e2020-09-28 23:13:15 +0200151
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 Moolenaarc3d27ad2022-11-14 20:52:14 +0000162func Test_spell_file_missing_bwipe()
163 " this was using a window that was wiped out in a SpellFileMissing autocmd
164 set spelllang=xy
165 au SpellFileMissing * n0
166 set spell
167 au SpellFileMissing * bw
168 snext somefile
169
170 au! SpellFileMissing
171 bwipe!
172 set nospell spelllang=en
173endfunc
174
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200175func Test_spelldump()
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100176 " In case the spell file is not found avoid getting the download dialog, we
177 " would get stuck at the prompt.
178 let g:en_not_found = 0
179 augroup TestSpellFileMissing
180 au! SpellFileMissing * let g:en_not_found = 1
181 augroup END
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200182 set spell spelllang=en
183 spellrare! emacs
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100184 if g:en_not_found
185 call assert_report("Could not find English spell file")
186 else
187 spelldump
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200188
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100189 " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
190 call assert_equal('/regions=usaucagbnz', getline(1))
191 call assert_notequal(0, search('^theater/1$')) " US English only.
192 call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English.
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200193
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100194 call assert_notequal(0, search('^emacs/?$')) " ? for a rare word.
195 call assert_notequal(0, search('^the the/!$')) " ! for a wrong word.
196 endif
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200197
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100198 " clean up
199 unlet g:en_not_found
200 augroup TestSpellFileMissing
201 autocmd! SpellFileMissing
202 augroup END
203 augroup! TestSpellFileMissing
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200204 bwipe
205 set spell&
206endfunc
207
208func Test_spelldump_bang()
209 new
210 call setline(1, 'This is a sample sentence.')
211 redraw
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100212
213 " In case the spell file is not found avoid getting the download dialog, we
214 " would get stuck at the prompt.
215 let g:en_not_found = 0
216 augroup TestSpellFileMissing
217 au! SpellFileMissing * let g:en_not_found = 1
218 augroup END
219
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200220 set spell
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200221
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100222 if g:en_not_found
223 call assert_report("Could not find English spell file")
224 else
225 redraw
226 spelldump!
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200227
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100228 " :spelldump! includes the number of times a word was found while updating
229 " the screen.
230 " Common word count starts at 10, regular word count starts at 0.
231 call assert_notequal(0, search("^is\t11$")) " common word found once.
232 call assert_notequal(0, search("^the\t10$")) " common word never found.
233 call assert_notequal(0, search("^sample\t1$")) " regular word found once.
234 call assert_equal(0, search("^screen\t")) " regular word never found.
235 endif
236
237 " clean up
238 unlet g:en_not_found
239 augroup TestSpellFileMissing
240 autocmd! SpellFileMissing
241 augroup END
242 augroup! TestSpellFileMissing
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200243 %bwipe!
244 set spell&
245endfunc
246
Bram Moolenaar8c7ad362020-09-27 13:58:38 +0200247func Test_spelllang_inv_region()
248 set spell spelllang=en_xx
249 let messages = GetMessages()
250 call assert_equal('Warning: region xx not supported', messages[-1])
251 set spell& spelllang&
252endfunc
253
254func Test_compl_with_CTRL_X_CTRL_K_using_spell()
255 " When spell checking is enabled and 'dictionary' is empty,
256 " CTRL-X CTRL-K in insert mode completes using the spelling dictionary.
257 new
258 set spell spelllang=en dictionary=
259
260 set ignorecase
261 call feedkeys("Senglis\<c-x>\<c-k>\<esc>", 'tnx')
262 call assert_equal(['English'], getline(1, '$'))
263 call feedkeys("SEnglis\<c-x>\<c-k>\<esc>", 'tnx')
264 call assert_equal(['English'], getline(1, '$'))
265
266 set noignorecase
267 call feedkeys("Senglis\<c-x>\<c-k>\<esc>", 'tnx')
268 call assert_equal(['englis'], getline(1, '$'))
269 call feedkeys("SEnglis\<c-x>\<c-k>\<esc>", 'tnx')
270 call assert_equal(['English'], getline(1, '$'))
271
272 set spelllang=en_us
273 call feedkeys("Stheat\<c-x>\<c-k>\<esc>", 'tnx')
274 call assert_equal(['theater'], getline(1, '$'))
275 set spelllang=en_gb
276 call feedkeys("Stheat\<c-x>\<c-k>\<esc>", 'tnx')
277 " FIXME: commented out, expected theatre bug got theater. See issue #7025.
278 " call assert_equal(['theatre'], getline(1, '$'))
279
280 bwipe!
281 set spell& spelllang& dictionary& ignorecase&
282endfunc
283
Bram Moolenaar545cb792017-05-23 11:31:22 +0200284func Test_spellreall()
285 new
286 set spell
287 call assert_fails('spellrepall', 'E752:')
288 call setline(1, ['A speling mistake. The same speling mistake.',
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200289 \ 'Another speling mistake.'])
Bram Moolenaar545cb792017-05-23 11:31:22 +0200290 call feedkeys(']s1z=', 'tx')
291 call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
292 call assert_equal('Another speling mistake.', getline(2))
293 spellrepall
294 call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
295 call assert_equal('Another spelling mistake.', getline(2))
296 call assert_fails('spellrepall', 'E753:')
297 set spell&
298 bwipe!
299endfunc
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200300
Bram Moolenaar54e5fed2022-07-04 13:37:07 +0100301func Test_spell_dump_word_length()
302 " this was running over MAXWLEN
303 new
304 noremap 0 0a0zW0000000
305 sil! norm 0z=0
306 sil norm 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
307 sil! norm 0z=0
308
309 bwipe!
310 nunmap 0
311endfunc
312
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100313" Test spellsuggest({word} [, {max} [, {capital}]])
314func Test_spellsuggest()
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200315 " Verify suggestions are given even when spell checking is not enabled.
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100316 set nospell
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200317 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100318
319 set spell
320
321 " With 1 argument.
Bram Moolenaar76734052019-12-26 14:30:15 +0100322 call assert_equal(['march', 'March'], spellsuggest('marrch')[0:1])
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100323
324 " With 2 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100325 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100326
327 " With 3 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100328 call assert_equal(['march'], spellsuggest('marrch', 1, 0))
329 call assert_equal(['March'], spellsuggest('marrch', 1, 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100330
331 " Test with digits and hyphen.
332 call assert_equal('Carbon-14', spellsuggest('Carbon-15')[0])
333
334 " Comment taken from spellsuggest.c explains the following test cases:
335 "
336 " If there are more UPPER than lower case letters suggest an
337 " ALLCAP word. Otherwise, if the first letter is UPPER then
338 " suggest ONECAP. Exception: "ALl" most likely should be "All",
339 " require three upper case letters.
Bram Moolenaar76734052019-12-26 14:30:15 +0100340 call assert_equal(['THIRD', 'third'], spellsuggest('thIRD', 2))
341 call assert_equal(['third', 'THIRD'], spellsuggest('tHIrd', 2))
342 call assert_equal(['Third'], spellsuggest('THird', 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100343 call assert_equal(['All'], spellsuggest('ALl', 1))
344
Dominique Pellef645ee42021-12-05 13:21:18 +0000345 " Special suggestion for repeated 'the the'.
346 call assert_inrange(0, 2, index(spellsuggest('the the', 3), 'the'))
347 call assert_inrange(0, 2, index(spellsuggest('the the', 3), 'the'))
348 call assert_inrange(0, 2, index(spellsuggest('The the', 3), 'The'))
349
Bram Moolenaar0e05de42020-03-25 22:23:46 +0100350 call assert_fails("call spellsuggest('maxch', [])", 'E745:')
351 call assert_fails("call spellsuggest('maxch', 2, [])", 'E745:')
352
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200353 set spelllang=
354 call assert_fails("call spellsuggest('maxch')", 'E756:')
355 set spelllang&
356
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100357 set spell&
358endfunc
359
360" Test 'spellsuggest' option with methods fast, best and double.
361func Test_spellsuggest_option_methods()
362 set spell
363
Bram Moolenaar76734052019-12-26 14:30:15 +0100364 for e in ['latin1', 'utf-8']
365 exe 'set encoding=' .. e
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100366
Bram Moolenaar76734052019-12-26 14:30:15 +0100367 set spellsuggest=fast
368 call assert_equal(['Stick', 'Stitch'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100369
Bram Moolenaar76734052019-12-26 14:30:15 +0100370 " With best or double option, "Stitch" should become the top suggestion
371 " because of better phonetic matching.
372 set spellsuggest=best
373 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100374
Bram Moolenaar76734052019-12-26 14:30:15 +0100375 set spellsuggest=double
376 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
377 endfor
378
379 set spell& spellsuggest& encoding&
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100380endfunc
381
382" Test 'spellsuggest' option with value file:{filename}
383func Test_spellsuggest_option_file()
384 set spell spellsuggest=file:Xspellsuggest
385 call writefile(['emacs/vim',
386 \ 'theribal/terrible',
387 \ 'teribal/terrrible',
388 \ 'terribal'],
389 \ 'Xspellsuggest')
390
391 call assert_equal(['vim'], spellsuggest('emacs', 2))
392 call assert_equal(['terrible'], spellsuggest('theribal',2))
393
394 " If the suggestion is misspelled (*terrrible* with 3 r),
395 " it should not be proposed.
396 " The entry for "terribal" should be ignored because of missing slash.
397 call assert_equal([], spellsuggest('teribal', 2))
398 call assert_equal([], spellsuggest('terribal', 2))
399
400 set spell spellsuggest=best,file:Xspellsuggest
401 call assert_equal(['vim', 'Emacs'], spellsuggest('emacs', 2))
402 call assert_equal(['terrible', 'tribal'], spellsuggest('theribal', 2))
403 call assert_equal(['tribal'], spellsuggest('teribal', 1))
404 call assert_equal(['tribal'], spellsuggest('terribal', 1))
405
406 call delete('Xspellsuggest')
407 call assert_fails("call spellsuggest('vim')", "E484: Can't open file Xspellsuggest")
408
409 set spellsuggest& spell&
410endfunc
411
412" Test 'spellsuggest' option with value {number}
413" to limit the number of suggestions
414func Test_spellsuggest_option_number()
415 set spell spellsuggest=2,best
416 new
417
418 " We limited the number of suggestions to 2, so selecting
419 " the 1st and 2nd suggestion should correct the word, but
420 " selecting a 3rd suggestion should do nothing.
Bram Moolenaar76734052019-12-26 14:30:15 +0100421 call setline(1, 'A baord')
422 norm $1z=
423 call assert_equal('A board', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100424
Bram Moolenaar76734052019-12-26 14:30:15 +0100425 call setline(1, 'A baord')
426 norm $2z=
427 call assert_equal('A bard', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100428
Bram Moolenaar76734052019-12-26 14:30:15 +0100429 call setline(1, 'A baord')
430 norm $3z=
431 call assert_equal('A baord', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100432
Bram Moolenaar76734052019-12-26 14:30:15 +0100433 let a = execute('norm $z=')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100434 call assert_equal(
435 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100436 \ .. "Change \"baord\" to:\n"
437 \ .. " 1 \"board\"\n"
438 \ .. " 2 \"bard\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200439 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100440
441 set spell spellsuggest=0
Bram Moolenaar76734052019-12-26 14:30:15 +0100442 call assert_equal("\nSorry, no suggestions", execute('norm $z='))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100443
444 " Unlike z=, function spellsuggest(...) should not be affected by the
445 " max number of suggestions (2) set by the 'spellsuggest' option.
Bram Moolenaar76734052019-12-26 14:30:15 +0100446 call assert_equal(['board', 'bard', 'broad'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100447
448 set spellsuggest& spell&
449 bwipe!
450endfunc
451
452" Test 'spellsuggest' option with value expr:{expr}
453func Test_spellsuggest_option_expr()
454 " A silly 'spellsuggest' function which makes suggestions all uppercase
455 " and makes the score of each suggestion the length of the suggested word.
456 " So shorter suggestions are preferred.
457 func MySuggest()
458 let spellsuggest_save = &spellsuggest
Bram Moolenaar76734052019-12-26 14:30:15 +0100459 set spellsuggest=3,best
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100460 let result = map(spellsuggest(v:val, 3), "[toupper(v:val), len(v:val)]")
461 let &spellsuggest = spellsuggest_save
462 return result
463 endfunc
464
Bram Moolenaar76734052019-12-26 14:30:15 +0100465 set spell spellsuggest=expr:MySuggest()
466 call assert_equal(['BARD', 'BOARD', 'BROAD'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100467
468 new
Bram Moolenaar76734052019-12-26 14:30:15 +0100469 call setline(1, 'baord')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100470 let a = execute('norm z=')
471 call assert_equal(
472 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100473 \ .. "Change \"baord\" to:\n"
474 \ .. " 1 \"BARD\"\n"
475 \ .. " 2 \"BOARD\"\n"
476 \ .. " 3 \"BROAD\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200477 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100478
479 " With verbose, z= should show the score i.e. word length with
480 " our SpellSuggest() function.
481 set verbose=1
482 let a = execute('norm z=')
483 call assert_equal(
484 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100485 \ .. "Change \"baord\" to:\n"
486 \ .. " 1 \"BARD\" (4 - 0)\n"
487 \ .. " 2 \"BOARD\" (5 - 0)\n"
488 \ .. " 3 \"BROAD\" (5 - 0)\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200489 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100490
491 set spell& spellsuggest& verbose&
492 bwipe!
493endfunc
494
Dominique Pelle81b573d2022-03-22 21:14:55 +0000495" Test for 'spellsuggest' expr errors
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100496func Test_spellsuggest_expr_errors()
497 " 'spellsuggest'
498 func MySuggest()
499 return range(3)
500 endfunc
501 set spell spellsuggest=expr:MySuggest()
502 call assert_equal([], spellsuggest('baord', 3))
503
504 " Test for 'spellsuggest' expression returning a non-list value
505 func! MySuggest2()
506 return 'good'
507 endfunc
508 set spellsuggest=expr:MySuggest2()
509 call assert_equal([], spellsuggest('baord'))
510
511 " Test for 'spellsuggest' expression returning a list with dict values
512 func! MySuggest3()
513 return [[{}, {}]]
514 endfunc
515 set spellsuggest=expr:MySuggest3()
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200516 call assert_fails("call spellsuggest('baord')", 'E731:')
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100517
518 set nospell spellsuggest&
519 delfunc MySuggest
520 delfunc MySuggest2
521 delfunc MySuggest3
522endfunc
523
Bram Moolenaar585ee072022-01-29 11:22:17 +0000524func Test_spellsuggest_timeout()
525 set spellsuggest=timeout:30
526 set spellsuggest=timeout:-123
527 set spellsuggest=timeout:999999
528 call assert_fails('set spellsuggest=timeout', 'E474:')
529 call assert_fails('set spellsuggest=timeout:x', 'E474:')
530 call assert_fails('set spellsuggest=timeout:-x', 'E474:')
531 call assert_fails('set spellsuggest=timeout:--9', 'E474:')
532endfunc
533
Bram Moolenaar5c686172022-03-13 20:12:25 +0000534func Test_spellsuggest_visual_end_of_line()
535 let enc_save = &encoding
536 set encoding=iso8859
537
538 " This was reading beyond the end of the line.
539 norm R00000000000
540 sil norm 0
541 sil! norm i00000)
542 sil! norm i00000)
543 call feedkeys("\<CR>")
544 norm z=
545
546 let &encoding = enc_save
547endfunc
548
Bram Moolenaar9049b682018-08-31 22:26:53 +0200549func Test_spellinfo()
550 new
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200551 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
Bram Moolenaar9049b682018-08-31 22:26:53 +0200552
553 set enc=latin1 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200554 call assert_match("^\nfile: " .. runtime .. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200555
556 set enc=cp1250 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200557 call assert_match("^\nfile: " .. runtime .. "/spell/en.ascii.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200558
Bram Moolenaar30276f22019-01-24 17:59:39 +0100559 set enc=utf-8 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200560 call assert_match("^\nfile: " .. runtime .. "/spell/en.utf-8.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200561
562 set enc=latin1 spell spelllang=en_us,en_nz
563 call assert_match("^\n" .
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200564 \ "file: " .. runtime .. "/spell/en.latin1.spl\n" .
565 \ "file: " .. runtime.. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200566
567 set spell spelllang=
568 call assert_fails('spellinfo', 'E756:')
569
570 set nospell spelllang=en
571 call assert_fails('spellinfo', 'E756:')
572
Bram Moolenaar8f130ed2019-04-10 22:15:19 +0200573 call assert_fails('set spelllang=foo/bar', 'E474:')
574 call assert_fails('set spelllang=foo\ bar', 'E474:')
575 call assert_fails("set spelllang=foo\\\nbar", 'E474:')
576 call assert_fails("set spelllang=foo\\\rbar", 'E474:')
577 call assert_fails("set spelllang=foo+bar", 'E474:')
578
Bram Moolenaar9049b682018-08-31 22:26:53 +0200579 set enc& spell& spelllang&
580 bwipe
581endfunc
582
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200583func Test_zz_basic()
584 call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
585 call RunGoodBad("wrong OK puts. Test the end",
586 \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
587 \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
588 \ "test", "testen", "testn", "the end", "uk", "wrong"],
589 \[
590 \ ["bad", ["put", "uk", "OK"]],
591 \ ["inputs", ["input", "puts", "outputs"]],
592 \ ["comment", ["Comment", "outtest", "the end"]],
593 \ ["ok", ["OK", "uk", "put"]],
594 \ ["Ok", ["OK", "Uk", "Put"]],
595 \ ["test", ["Test", "testn", "testen"]],
596 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
597 \ ["end", ["put", "uk", "test"]],
598 \ ["the", ["put", "uk", "test"]],
599 \ ]
600 \ )
601
602 call assert_equal("gebletegek", soundfold('goobledygoook'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200603 call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200604 call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
605endfunc
606
607" Postponed prefixes
608func Test_zz_prefixes()
609 call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
610 call RunGoodBad("puts",
611 \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
612 \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
613 \ [
614 \ ["bad", ["put", "uk", "OK"]],
615 \ ["inputs", ["input", "puts", "outputs"]],
616 \ ["comment", ["Comment"]],
617 \ ["ok", ["OK", "uk", "put"]],
618 \ ["Ok", ["OK", "Uk", "Put"]],
619 \ ["end", ["put", "uk", "deol"]],
620 \ ["the", ["put", "uk", "test"]],
621 \ ["test", ["Test", "testn", "testen"]],
622 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
623 \ ])
624endfunc
625
626"Compound words
627func Test_zz_compound()
628 call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
629 call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
630 \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
631 \ ["foo", "m\xEF"],
632 \ [
633 \ ["bad", ["foo", "m\xEF"]],
634 \ ["bar", ["barfoo", "foobar", "foo"]],
635 \ ["la", ["m\xEF", "foo"]],
636 \ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
637 \ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
638 \ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
639 \ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
640 \ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
641 \ ["lala", []],
642 \ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
643 \ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
644 \ ["foola", ["foo", "foobar", "foofoo"]],
645 \ ["labar", ["barbar", "foobar"]],
646 \ ])
647
648 call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
649 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",
650 \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword",
651 \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
652 \ [
653 \ ["bad", ["end", "bork", "word"]],
654 \ ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
655 \ ["pro", ["bork", "word", "end"]],
656 \ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
657 \ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
658 \ ["endstart", ["end start", "start"]],
659 \ ["endend", ["end end", "end"]],
660 \ ["startstart", ["start start"]],
661 \ ["wordend", ["word end", "word", "wordword"]],
662 \ ["wordstart", ["word start", "bork start"]],
663 \ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
664 \ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
665 \ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
666 \ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
667 \ ["utilsbork", ["utilbork", "utils bork", "util bork"]],
668 \ ["startnouword", ["start nouword", "startword", "startborkword"]],
669 \ ])
670
671endfunc
672
673"Test affix flags with two characters
674func Test_zz_affix()
675 call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
676 call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend",
677 \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
678 \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
679 \ [
680 \ ["bad", ["bar", "end", "fooa1"]],
681 \ ["foo", ["fooa1", "fooa\xE9", "bar"]],
682 \ ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
683 \ ["prabar", ["prebar", "bar", "bar bar"]],
684 \ ["probarbirk", ["prebarbork"]],
685 \ ["middle", []],
686 \ ["startmiddle", ["startmiddleend", "startmiddlebar"]],
687 \ ["middleend", []],
688 \ ["endstart", ["end start", "start"]],
689 \ ["startprobar", ["startprebar", "start prebar", "startbar"]],
690 \ ["startnouend", ["start nouend", "startend"]],
691 \ ])
692
693 call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
694 call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend",
695 \ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
696 \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
697 \ [
698 \ ["bad", ["bar", "end", "lead"]],
699 \ ["mee", ["meea1", "meea\xE9", "bar"]],
700 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
701 \ ["prabar", ["prebar", "bar", "leadbar"]],
702 \ ["probarbirk", ["prebarbork"]],
703 \ ["middle", []],
704 \ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
705 \ ["middleend", []],
706 \ ["endlead", ["end lead", "lead", "end end"]],
707 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
708 \ ])
709
710 call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100711 call RunGoodBad("meea1 meezero meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200712 \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100713 \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "meezero", "prebar", "prebarmeat", "tail"],
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200714 \ [
715 \ ["bad", ["bar", "lead", "tail"]],
716 \ ["mee", ["meea1", "meea\xE9", "bar"]],
717 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
718 \ ["prabar", ["prebar", "bar", "leadbar"]],
719 \ ["probarmaat", ["prebarmeat"]],
720 \ ["middle", []],
721 \ ["leadmiddle", ["leadmiddlebar"]],
722 \ ["middletail", []],
723 \ ["taillead", ["tail lead", "tail"]],
724 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
725 \ ])
726endfunc
727
728func Test_zz_NOSLITSUGS()
729 call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
730 call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
731 \ ["bar", "faabar", "foo"],
732 \ [
733 \ ["bad", ["bar", "foo"]],
734 \ ["foobar", ["faabar", "foo bar", "bar"]],
735 \ ["barfoo", ["bar foo", "bar", "foo"]],
736 \ ])
737endfunc
738
739" Numbers
740func Test_zz_Numbers()
741 call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
742 call RunGoodBad("0b1011 0777 1234 0x01ff", "",
743 \ ["bar", "foo"],
744 \ [
745 \ ])
746endfunc
747
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +0100748" Affix flags
749func Test_zz_affix_flags()
750 call LoadAffAndDic(g:test_data_aff10, g:test_data_dic10)
751 call RunGoodBad("drink drinkable drinkables drinktable drinkabletable",
752 \ "bad: drinks drinkstable drinkablestable",
753 \ ["drink", "drinkable", "drinkables", "table"],
754 \ [['bad', []],
755 \ ['drinks', ['drink']],
756 \ ['drinkstable', ['drinktable', 'drinkable', 'drink table']],
757 \ ['drinkablestable', ['drinkabletable', 'drinkables table', 'drinkable table']],
758 \ ])
759endfunc
760
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200761function FirstSpellWord()
762 call feedkeys("/^start:\n", 'tx')
763 normal ]smm
764 let [str, a] = spellbadword()
765 return str
766endfunc
767
768function SecondSpellWord()
769 normal `m]s
770 let [str, a] = spellbadword()
771 return str
772endfunc
773
774"Test with SAL instead of SOFO items; test automatic reloading
775func Test_zz_sal_and_addition()
776 set enc=latin1
777 set spellfile=
Bram Moolenaar56564962022-10-10 22:39:42 +0100778 call writefile(g:test_data_dic1, "Xtest.dic", 'D')
779 call writefile(g:test_data_aff_sal, "Xtest.aff", 'D')
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200780 mkspell! Xtest Xtest
781 set spl=Xtest.latin1.spl spell
782 call assert_equal('kbltykk', soundfold('goobledygoook'))
783 call assert_equal('kprnfn', soundfold('kóopërÿnôven'))
784 call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
785
786 "also use an addition file
Bram Moolenaar56564962022-10-10 22:39:42 +0100787 call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add", 'D')
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200788 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
789
790 bwipe!
791 call setline(1, ["start: elequint test elekwint test elekwent asdf"])
792
793 set spellfile=Xtest.latin1.add
794 call assert_equal("elekwent", FirstSpellWord())
795
796 set spl=Xtest_us.latin1.spl
797 call assert_equal("elequint", FirstSpellWord())
798 call assert_equal("elekwint", SecondSpellWord())
799
800 set spl=Xtest_gb.latin1.spl
801 call assert_equal("elekwint", FirstSpellWord())
802 call assert_equal("elekwent", SecondSpellWord())
803
804 set spl=Xtest_nz.latin1.spl
805 call assert_equal("elequint", FirstSpellWord())
806 call assert_equal("elekwent", SecondSpellWord())
807
808 set spl=Xtest_ca.latin1.spl
809 call assert_equal("elequint", FirstSpellWord())
810 call assert_equal("elekwint", SecondSpellWord())
zeertzjq288ed232022-07-04 11:03:07 +0100811
812 bwipe!
813 set spellfile=
814 set spl&
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200815endfunc
816
Bram Moolenaar862f1e12019-04-10 22:33:41 +0200817func Test_spellfile_value()
818 set spellfile=Xdir/Xtest.latin1.add
819 set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
820endfunc
821
Bram Moolenaaree03b942017-10-27 00:57:05 +0200822func Test_region_error()
823 messages clear
Bram Moolenaar56564962022-10-10 22:39:42 +0100824 call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add", 'D')
Bram Moolenaaree03b942017-10-27 00:57:05 +0200825 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
826 call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
Bram Moolenaaree03b942017-10-27 00:57:05 +0200827 call delete('Xtest.latin1.add.spl')
828endfunc
829
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200830" Check using z= in new buffer (crash fixed by patch 7.4a.028).
831func Test_zeq_crash()
832 new
833 set maxmem=512 spell
834 call feedkeys('iasdz=:\"', 'tx')
835
836 bwipe!
837endfunc
838
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200839" Check that z= works even when 'nospell' is set. This test uses one of the
840" tests in Test_spellsuggest_option_number() just to verify that z= basically
841" works and that "E756: Spell checking is not enabled" is not generated.
842func Test_zeq_nospell()
843 new
844 set nospell spellsuggest=1,best
845 call setline(1, 'A baord')
846 try
847 norm $1z=
848 call assert_equal('A board', getline(1))
849 catch
850 call assert_report("Caught exception: " . v:exception)
851 endtry
852 set spell& spellsuggest&
853 bwipe!
854endfunc
855
856" Check that "E756: Spell checking is not possible" is reported when z= is
857" executed and 'spelllang' is empty.
858func Test_zeq_no_spelllang()
859 new
860 set spelllang= spellsuggest=1,best
861 call setline(1, 'A baord')
862 call assert_fails('normal $1z=', 'E756:')
863 set spelllang& spellsuggest&
864 bwipe!
865endfunc
866
Bram Moolenaar5bcc5a12019-08-06 22:48:02 +0200867" Check handling a word longer than MAXWLEN.
868func Test_spell_long_word()
869 set enc=utf-8
870 new
871 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")
872 set spell spelllang=en
873 redraw
874 redraw!
875 bwipe!
876 set nospell
877endfunc
878
Bram Moolenaar06f15412022-01-29 10:51:59 +0000879func Test_spellsuggest_too_deep()
880 " This was incrementing "depth" over MAXWLEN.
881 new
882 norm s000G00ý000000000000
883 sil norm ..vzG................vvzG0 v z=
884 bwipe!
885endfunc
886
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100887func Test_spell_good_word_invalid()
888 " This was adding a word with a 0x02 byte, which causes havoc.
889 enew
890 norm o0
891 sil! norm rzzWs00/
892 2
893 sil! norm VzGprzzW
894 sil! norm z=
895
896 bwipe!
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100897endfunc
898
K.Takata2ebcc352022-07-14 17:25:14 +0100899func Test_spell_good_word_slash()
900 " This caused E1280.
901 new
902 norm afoo /
903 1
904 norm zG
905
906 bwipe!
907endfunc
908
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200909func LoadAffAndDic(aff_contents, dic_contents)
910 set enc=latin1
911 set spellfile=
912 call writefile(a:aff_contents, "Xtest.aff")
913 call writefile(a:dic_contents, "Xtest.dic")
914 " Generate a .spl file from a .dic and .aff file.
915 mkspell! Xtest Xtest
916 " use that spell file
917 set spl=Xtest.latin1.spl spell
918endfunc
919
920func ListWords()
921 spelldump
922 %yank
923 quit
924 return split(@", "\n")
925endfunc
926
927func TestGoodBadBase()
928 exe '1;/^good:'
929 normal 0f:]s
930 let prevbad = ''
931 let result = []
932 while 1
933 let [bad, a] = spellbadword()
934 if bad == '' || bad == prevbad || bad == 'badend'
935 break
936 endif
937 let prevbad = bad
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200938 let lst = bad->spellsuggest(3)
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200939 normal mm
940
941 call add(result, [bad, lst])
942 normal `m]s
943 endwhile
944 return result
945endfunc
946
947func RunGoodBad(good, bad, expected_words, expected_bad_words)
948 bwipe!
949 call setline(1, ["good: ", a:good, a:bad, " badend "])
950 let words = ListWords()
951 call assert_equal(a:expected_words, words[1:-1])
952 let bad_words = TestGoodBadBase()
953 call assert_equal(a:expected_bad_words, bad_words)
954 bwipe!
955endfunc
956
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200957func Test_spell_screendump()
958 CheckScreendump
959
960 let lines =<< trim END
961 call setline(1, [
962 \ "This is some text without any spell errors. Everything",
963 \ "should just be black, nothing wrong here.",
964 \ "",
965 \ "This line has a sepll error. and missing caps.",
966 \ "And and this is the the duplication.",
967 \ "with missing caps here.",
968 \ ])
969 set spell spelllang=en_nz
970 END
Bram Moolenaarf3ef0262022-10-05 13:29:15 +0100971 call writefile(lines, 'XtestSpell', 'D')
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200972 let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
973 call VerifyScreenDump(buf, 'Test_spell_1', {})
974
975 " clean up
976 call StopVimInTerminal(buf)
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200977endfunc
978
Christian Brabandtafa23d12022-08-09 12:25:10 +0100979func Test_spell_screendump_spellcap()
980 CheckScreendump
981
982 let lines =<< trim END
983 call setline(1, [
984 \ " This line has a sepll error. and missing caps and trailing spaces. ",
985 \ "another missing cap here.",
986 \ "",
987 \ "and here.",
988 \ " ",
989 \ "and here."
990 \ ])
991 set spell spelllang=en
992 END
Bram Moolenaarf3ef0262022-10-05 13:29:15 +0100993 call writefile(lines, 'XtestSpellCap', 'D')
Christian Brabandtafa23d12022-08-09 12:25:10 +0100994 let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8})
995 call VerifyScreenDump(buf, 'Test_spell_2', {})
996
Bram Moolenaaree09fcc2022-09-25 20:58:30 +0100997 " After adding word missing Cap in next line is updated
998 call term_sendkeys(buf, "3GANot\<Esc>")
999 call VerifyScreenDump(buf, 'Test_spell_3', {})
1000
Bram Moolenaar26f09ea2022-09-27 16:29:38 +01001001 " Deleting a full stop removes missing Cap in next line
1002 call term_sendkeys(buf, "5Gddk$x")
1003 call VerifyScreenDump(buf, 'Test_spell_4', {})
1004
1005 " Undo also updates the next line (go to command line to remove message)
1006 call term_sendkeys(buf, "u:\<Esc>")
1007 call VerifyScreenDump(buf, 'Test_spell_5', {})
1008
Christian Brabandtafa23d12022-08-09 12:25:10 +01001009 " clean up
1010 call StopVimInTerminal(buf)
Bram Moolenaarf3ef0262022-10-05 13:29:15 +01001011endfunc
1012
1013func Test_spell_compatible()
1014 CheckScreendump
1015
1016 let lines =<< trim END
1017 call setline(1, [
1018 \ "test "->repeat(20),
1019 \ "",
1020 \ "end",
1021 \ ])
1022 set spell cpo+=$
1023 END
1024 call writefile(lines, 'XtestSpellComp', 'D')
1025 let buf = RunVimInTerminal('-S XtestSpellComp', {'rows': 8})
1026
1027 call term_sendkeys(buf, "51|C")
1028 call VerifyScreenDump(buf, 'Test_spell_compatible_1', {})
1029
1030 call term_sendkeys(buf, "x")
1031 call VerifyScreenDump(buf, 'Test_spell_compatible_2', {})
1032
1033 " clean up
1034 call StopVimInTerminal(buf)
Christian Brabandtafa23d12022-08-09 12:25:10 +01001035endfunc
1036
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001037let g:test_data_aff1 = [
1038 \"SET ISO8859-1",
1039 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1040 \"",
1041 \"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",
1042 \"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",
1043 \"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",
1044 \"",
1045 \"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",
1046 \"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
1047 \"",
1048 \"MIDWORD\t'-",
1049 \"",
1050 \"KEP =",
1051 \"RAR ?",
1052 \"BAD !",
1053 \"",
1054 \"PFX I N 1",
1055 \"PFX I 0 in .",
1056 \"",
1057 \"PFX O Y 1",
1058 \"PFX O 0 out .",
1059 \"",
1060 \"SFX S Y 2",
1061 \"SFX S 0 s [^s]",
1062 \"SFX S 0 es s",
1063 \"",
1064 \"SFX N N 3",
1065 \"SFX N 0 en [^n]",
1066 \"SFX N 0 nen n",
1067 \"SFX N 0 n .",
1068 \"",
1069 \"REP 3",
1070 \"REP g ch",
1071 \"REP ch g",
1072 \"REP svp s.v.p.",
1073 \"",
1074 \"MAP 9",
1075 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1076 \"MAP e\xE8\xE9\xEA\xEB",
1077 \"MAP i\xEC\xED\xEE\xEF",
1078 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1079 \"MAP u\xF9\xFA\xFB\xFC",
1080 \"MAP n\xF1",
1081 \"MAP c\xE7",
1082 \"MAP y\xFF\xFD",
1083 \"MAP s\xDF",
1084 \ ]
1085let g:test_data_dic1 = [
1086 \"123456",
1087 \"test/NO",
1088 \"# comment",
1089 \"wrong",
1090 \"Comment",
1091 \"OK",
1092 \"uk",
1093 \"put/ISO",
1094 \"the end",
1095 \"deol",
1096 \"d\xE9\xF4r",
1097 \ ]
1098let g:test_data_aff2 = [
1099 \"SET ISO8859-1",
1100 \"",
1101 \"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",
1102 \"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",
1103 \"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",
1104 \"",
1105 \"PFXPOSTPONE",
1106 \"",
1107 \"MIDWORD\t'-",
1108 \"",
1109 \"KEP =",
1110 \"RAR ?",
1111 \"BAD !",
1112 \"",
1113 \"PFX I N 1",
1114 \"PFX I 0 in .",
1115 \"",
1116 \"PFX O Y 1",
1117 \"PFX O 0 out [a-z]",
1118 \"",
1119 \"SFX S Y 2",
1120 \"SFX S 0 s [^s]",
1121 \"SFX S 0 es s",
1122 \"",
1123 \"SFX N N 3",
1124 \"SFX N 0 en [^n]",
1125 \"SFX N 0 nen n",
1126 \"SFX N 0 n .",
1127 \"",
1128 \"REP 3",
1129 \"REP g ch",
1130 \"REP ch g",
1131 \"REP svp s.v.p.",
1132 \"",
1133 \"MAP 9",
1134 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1135 \"MAP e\xE8\xE9\xEA\xEB",
1136 \"MAP i\xEC\xED\xEE\xEF",
1137 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1138 \"MAP u\xF9\xFA\xFB\xFC",
1139 \"MAP n\xF1",
1140 \"MAP c\xE7",
1141 \"MAP y\xFF\xFD",
1142 \"MAP s\xDF",
1143 \ ]
1144let g:test_data_aff3 = [
1145 \"SET ISO8859-1",
1146 \"",
1147 \"COMPOUNDMIN 3",
1148 \"COMPOUNDRULE m*",
1149 \"NEEDCOMPOUND x",
1150 \ ]
1151let g:test_data_dic3 = [
1152 \"1234",
1153 \"foo/m",
1154 \"bar/mx",
1155 \"m\xEF/m",
1156 \"la/mx",
1157 \ ]
1158let g:test_data_aff4 = [
1159 \"SET ISO8859-1",
1160 \"",
1161 \"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",
1162 \"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",
1163 \"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",
1164 \"",
1165 \"COMPOUNDRULE m+",
1166 \"COMPOUNDRULE sm*e",
1167 \"COMPOUNDRULE sm+",
1168 \"COMPOUNDMIN 3",
1169 \"COMPOUNDWORDMAX 3",
1170 \"COMPOUNDFORBIDFLAG t",
1171 \"",
1172 \"COMPOUNDSYLMAX 5",
1173 \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
1174 \"",
1175 \"MAP 9",
1176 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1177 \"MAP e\xE8\xE9\xEA\xEB",
1178 \"MAP i\xEC\xED\xEE\xEF",
1179 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1180 \"MAP u\xF9\xFA\xFB\xFC",
1181 \"MAP n\xF1",
1182 \"MAP c\xE7",
1183 \"MAP y\xFF\xFD",
1184 \"MAP s\xDF",
1185 \"",
1186 \"NEEDAFFIX x",
1187 \"",
1188 \"PFXPOSTPONE",
1189 \"",
1190 \"MIDWORD '-",
1191 \"",
1192 \"SFX q N 1",
1193 \"SFX q 0 -ok .",
1194 \"",
1195 \"SFX a Y 2",
1196 \"SFX a 0 s .",
1197 \"SFX a 0 ize/t .",
1198 \"",
1199 \"PFX p N 1",
1200 \"PFX p 0 pre .",
1201 \"",
1202 \"PFX P N 1",
1203 \"PFX P 0 nou .",
1204 \ ]
1205let g:test_data_dic4 = [
1206 \"1234",
1207 \"word/mP",
1208 \"util/am",
1209 \"pro/xq",
1210 \"tomato/m",
1211 \"bork/mp",
1212 \"start/s",
1213 \"end/e",
1214 \ ]
1215let g:test_data_aff5 = [
1216 \"SET ISO8859-1",
1217 \"",
1218 \"FLAG long",
1219 \"",
1220 \"NEEDAFFIX !!",
1221 \"",
1222 \"COMPOUNDRULE ssmm*ee",
1223 \"",
1224 \"NEEDCOMPOUND xx",
1225 \"COMPOUNDPERMITFLAG pp",
1226 \"",
1227 \"SFX 13 Y 1",
1228 \"SFX 13 0 bork .",
1229 \"",
1230 \"SFX a1 Y 1",
1231 \"SFX a1 0 a1 .",
1232 \"",
1233 \"SFX a\xE9 Y 1",
1234 \"SFX a\xE9 0 a\xE9 .",
1235 \"",
1236 \"PFX zz Y 1",
1237 \"PFX zz 0 pre/pp .",
1238 \"",
1239 \"PFX yy Y 1",
1240 \"PFX yy 0 nou .",
1241 \ ]
1242let g:test_data_dic5 = [
1243 \"1234",
1244 \"foo/a1a\xE9!!",
1245 \"bar/zz13ee",
1246 \"start/ss",
1247 \"end/eeyy",
1248 \"middle/mmxx",
1249 \ ]
1250let g:test_data_aff6 = [
1251 \"SET ISO8859-1",
1252 \"",
1253 \"FLAG caplong",
1254 \"",
1255 \"NEEDAFFIX A!",
1256 \"",
1257 \"COMPOUNDRULE sMm*Ee",
1258 \"",
1259 \"NEEDCOMPOUND Xx",
1260 \"",
1261 \"COMPOUNDPERMITFLAG p",
1262 \"",
1263 \"SFX N3 Y 1",
1264 \"SFX N3 0 bork .",
1265 \"",
1266 \"SFX A1 Y 1",
1267 \"SFX A1 0 a1 .",
1268 \"",
1269 \"SFX A\xE9 Y 1",
1270 \"SFX A\xE9 0 a\xE9 .",
1271 \"",
1272 \"PFX Zz Y 1",
1273 \"PFX Zz 0 pre/p .",
1274 \ ]
1275let g:test_data_dic6 = [
1276 \"1234",
1277 \"mee/A1A\xE9A!",
1278 \"bar/ZzN3Ee",
1279 \"lead/s",
1280 \"end/Ee",
1281 \"middle/MmXx",
1282 \ ]
1283let g:test_data_aff7 = [
1284 \"SET ISO8859-1",
1285 \"",
1286 \"FLAG num",
1287 \"",
1288 \"NEEDAFFIX 9999",
1289 \"",
1290 \"COMPOUNDRULE 2,77*123",
1291 \"",
1292 \"NEEDCOMPOUND 1",
1293 \"COMPOUNDPERMITFLAG 432",
1294 \"",
1295 \"SFX 61003 Y 1",
1296 \"SFX 61003 0 meat .",
1297 \"",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001298 \"SFX 0 Y 1",
1299 \"SFX 0 0 zero .",
1300 \"",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001301 \"SFX 391 Y 1",
1302 \"SFX 391 0 a1 .",
1303 \"",
1304 \"SFX 111 Y 1",
1305 \"SFX 111 0 a\xE9 .",
1306 \"",
1307 \"PFX 17 Y 1",
1308 \"PFX 17 0 pre/432 .",
1309 \ ]
1310let g:test_data_dic7 = [
1311 \"1234",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001312 \"mee/0,391,111,9999",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001313 \"bar/17,61003,123",
1314 \"lead/2",
1315 \"tail/123",
1316 \"middle/77,1",
1317 \ ]
1318let g:test_data_aff8 = [
1319 \"SET ISO8859-1",
1320 \"",
1321 \"NOSPLITSUGS",
1322 \ ]
1323let g:test_data_dic8 = [
1324 \"1234",
1325 \"foo",
1326 \"bar",
1327 \"faabar",
1328 \ ]
1329let g:test_data_aff9 = [
1330 \ ]
1331let g:test_data_dic9 = [
1332 \"1234",
1333 \"foo",
1334 \"bar",
1335 \ ]
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +01001336let g:test_data_aff10 = [
1337 \"COMPOUNDRULE se",
1338 \"COMPOUNDPERMITFLAG p",
1339 \"",
1340 \"SFX A Y 1",
1341 \"SFX A 0 able/Mp .",
1342 \"",
1343 \"SFX M Y 1",
1344 \"SFX M 0 s .",
1345 \ ]
1346let g:test_data_dic10 = [
1347 \"1234",
1348 \"drink/As",
1349 \"table/e",
1350 \ ]
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001351let g:test_data_aff_sal = [
1352 \"SET ISO8859-1",
1353 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1354 \"",
1355 \"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",
1356 \"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",
1357 \"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",
1358 \"",
1359 \"MIDWORD\t'-",
1360 \"",
1361 \"KEP =",
1362 \"RAR ?",
1363 \"BAD !",
1364 \"",
1365 \"PFX I N 1",
1366 \"PFX I 0 in .",
1367 \"",
1368 \"PFX O Y 1",
1369 \"PFX O 0 out .",
1370 \"",
1371 \"SFX S Y 2",
1372 \"SFX S 0 s [^s]",
1373 \"SFX S 0 es s",
1374 \"",
1375 \"SFX N N 3",
1376 \"SFX N 0 en [^n]",
1377 \"SFX N 0 nen n",
1378 \"SFX N 0 n .",
1379 \"",
1380 \"REP 3",
1381 \"REP g ch",
1382 \"REP ch g",
1383 \"REP svp s.v.p.",
1384 \"",
1385 \"MAP 9",
1386 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1387 \"MAP e\xE8\xE9\xEA\xEB",
1388 \"MAP i\xEC\xED\xEE\xEF",
1389 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1390 \"MAP u\xF9\xFA\xFB\xFC",
1391 \"MAP n\xF1",
1392 \"MAP c\xE7",
1393 \"MAP y\xFF\xFD",
1394 \"MAP s\xDF",
1395 \"",
1396 \"SAL AH(AEIOUY)-^ *H",
1397 \"SAL AR(AEIOUY)-^ *R",
1398 \"SAL A(HR)^ *",
1399 \"SAL A^ *",
1400 \"SAL AH(AEIOUY)- H",
1401 \"SAL AR(AEIOUY)- R",
1402 \"SAL A(HR) _",
1403 \"SAL \xC0^ *",
1404 \"SAL \xC5^ *",
1405 \"SAL BB- _",
1406 \"SAL B B",
1407 \"SAL CQ- _",
1408 \"SAL CIA X",
1409 \"SAL CH X",
1410 \"SAL C(EIY)- S",
1411 \"SAL CK K",
1412 \"SAL COUGH^ KF",
1413 \"SAL CC< C",
1414 \"SAL C K",
1415 \"SAL DG(EIY) K",
1416 \"SAL DD- _",
1417 \"SAL D T",
1418 \"SAL \xC9< E",
1419 \"SAL EH(AEIOUY)-^ *H",
1420 \"SAL ER(AEIOUY)-^ *R",
1421 \"SAL E(HR)^ *",
1422 \"SAL ENOUGH^$ *NF",
1423 \"SAL E^ *",
1424 \"SAL EH(AEIOUY)- H",
1425 \"SAL ER(AEIOUY)- R",
1426 \"SAL E(HR) _",
1427 \"SAL FF- _",
1428 \"SAL F F",
1429 \"SAL GN^ N",
1430 \"SAL GN$ N",
1431 \"SAL GNS$ NS",
1432 \"SAL GNED$ N",
1433 \"SAL GH(AEIOUY)- K",
1434 \"SAL GH _",
1435 \"SAL GG9 K",
1436 \"SAL G K",
1437 \"SAL H H",
1438 \"SAL IH(AEIOUY)-^ *H",
1439 \"SAL IR(AEIOUY)-^ *R",
1440 \"SAL I(HR)^ *",
1441 \"SAL I^ *",
1442 \"SAL ING6 N",
1443 \"SAL IH(AEIOUY)- H",
1444 \"SAL IR(AEIOUY)- R",
1445 \"SAL I(HR) _",
1446 \"SAL J K",
1447 \"SAL KN^ N",
1448 \"SAL KK- _",
1449 \"SAL K K",
1450 \"SAL LAUGH^ LF",
1451 \"SAL LL- _",
1452 \"SAL L L",
1453 \"SAL MB$ M",
1454 \"SAL MM M",
1455 \"SAL M M",
1456 \"SAL NN- _",
1457 \"SAL N N",
1458 \"SAL OH(AEIOUY)-^ *H",
1459 \"SAL OR(AEIOUY)-^ *R",
1460 \"SAL O(HR)^ *",
1461 \"SAL O^ *",
1462 \"SAL OH(AEIOUY)- H",
1463 \"SAL OR(AEIOUY)- R",
1464 \"SAL O(HR) _",
1465 \"SAL PH F",
1466 \"SAL PN^ N",
1467 \"SAL PP- _",
1468 \"SAL P P",
1469 \"SAL Q K",
1470 \"SAL RH^ R",
1471 \"SAL ROUGH^ RF",
1472 \"SAL RR- _",
1473 \"SAL R R",
1474 \"SAL SCH(EOU)- SK",
1475 \"SAL SC(IEY)- S",
1476 \"SAL SH X",
1477 \"SAL SI(AO)- X",
1478 \"SAL SS- _",
1479 \"SAL S S",
1480 \"SAL TI(AO)- X",
1481 \"SAL TH @",
1482 \"SAL TCH-- _",
1483 \"SAL TOUGH^ TF",
1484 \"SAL TT- _",
1485 \"SAL T T",
1486 \"SAL UH(AEIOUY)-^ *H",
1487 \"SAL UR(AEIOUY)-^ *R",
1488 \"SAL U(HR)^ *",
1489 \"SAL U^ *",
1490 \"SAL UH(AEIOUY)- H",
1491 \"SAL UR(AEIOUY)- R",
1492 \"SAL U(HR) _",
1493 \"SAL V^ W",
1494 \"SAL V F",
1495 \"SAL WR^ R",
1496 \"SAL WH^ W",
1497 \"SAL W(AEIOU)- W",
1498 \"SAL X^ S",
1499 \"SAL X KS",
1500 \"SAL Y(AEIOU)- Y",
1501 \"SAL ZZ- _",
1502 \"SAL Z S",
1503 \ ]
Bram Moolenaar0e05de42020-03-25 22:23:46 +01001504
1505" vim: shiftwidth=2 sts=2 expandtab