blob: 9eecb1e3f58dd7f7d7b955343bb2047279eece63 [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')
LemonBoye98fb642023-08-15 23:07:55 +0200277 call assert_equal(['theatre'], getline(1, '$'))
Bram Moolenaar8c7ad362020-09-27 13:58:38 +0200278
279 bwipe!
280 set spell& spelllang& dictionary& ignorecase&
281endfunc
282
zeertzjq59f70382023-06-06 15:59:59 +0100283func Test_spellrepall()
Bram Moolenaar545cb792017-05-23 11:31:22 +0200284 new
285 set spell
286 call assert_fails('spellrepall', 'E752:')
287 call setline(1, ['A speling mistake. The same speling mistake.',
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200288 \ 'Another speling mistake.'])
Bram Moolenaar545cb792017-05-23 11:31:22 +0200289 call feedkeys(']s1z=', 'tx')
290 call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
291 call assert_equal('Another speling mistake.', getline(2))
292 spellrepall
293 call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
294 call assert_equal('Another spelling mistake.', getline(2))
295 call assert_fails('spellrepall', 'E753:')
296 set spell&
297 bwipe!
298endfunc
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200299
Bram Moolenaar54e5fed2022-07-04 13:37:07 +0100300func Test_spell_dump_word_length()
301 " this was running over MAXWLEN
302 new
303 noremap 0 0a0zW0000000
304 sil! norm 0z=0
305 sil norm 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
306 sil! norm 0z=0
307
308 bwipe!
309 nunmap 0
310endfunc
311
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100312" Test spellsuggest({word} [, {max} [, {capital}]])
313func Test_spellsuggest()
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200314 " Verify suggestions are given even when spell checking is not enabled.
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100315 set nospell
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200316 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100317
318 set spell
319
320 " With 1 argument.
Bram Moolenaar76734052019-12-26 14:30:15 +0100321 call assert_equal(['march', 'March'], spellsuggest('marrch')[0:1])
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100322
323 " With 2 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100324 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100325
326 " With 3 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100327 call assert_equal(['march'], spellsuggest('marrch', 1, 0))
328 call assert_equal(['March'], spellsuggest('marrch', 1, 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100329
330 " Test with digits and hyphen.
331 call assert_equal('Carbon-14', spellsuggest('Carbon-15')[0])
332
333 " Comment taken from spellsuggest.c explains the following test cases:
334 "
335 " If there are more UPPER than lower case letters suggest an
336 " ALLCAP word. Otherwise, if the first letter is UPPER then
337 " suggest ONECAP. Exception: "ALl" most likely should be "All",
338 " require three upper case letters.
Bram Moolenaar76734052019-12-26 14:30:15 +0100339 call assert_equal(['THIRD', 'third'], spellsuggest('thIRD', 2))
340 call assert_equal(['third', 'THIRD'], spellsuggest('tHIrd', 2))
341 call assert_equal(['Third'], spellsuggest('THird', 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100342 call assert_equal(['All'], spellsuggest('ALl', 1))
343
Dominique Pellef645ee42021-12-05 13:21:18 +0000344 " Special suggestion for repeated 'the the'.
345 call assert_inrange(0, 2, index(spellsuggest('the the', 3), '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
Bram Moolenaar0e05de42020-03-25 22:23:46 +0100349 call assert_fails("call spellsuggest('maxch', [])", 'E745:')
350 call assert_fails("call spellsuggest('maxch', 2, [])", 'E745:')
351
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200352 set spelllang=
353 call assert_fails("call spellsuggest('maxch')", 'E756:')
354 set spelllang&
355
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100356 set spell&
357endfunc
358
359" Test 'spellsuggest' option with methods fast, best and double.
360func Test_spellsuggest_option_methods()
361 set spell
362
Bram Moolenaar76734052019-12-26 14:30:15 +0100363 for e in ['latin1', 'utf-8']
364 exe 'set encoding=' .. e
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100365
Bram Moolenaar76734052019-12-26 14:30:15 +0100366 set spellsuggest=fast
367 call assert_equal(['Stick', 'Stitch'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100368
Bram Moolenaar76734052019-12-26 14:30:15 +0100369 " With best or double option, "Stitch" should become the top suggestion
370 " because of better phonetic matching.
371 set spellsuggest=best
372 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100373
Bram Moolenaar76734052019-12-26 14:30:15 +0100374 set spellsuggest=double
375 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
376 endfor
377
378 set spell& spellsuggest& encoding&
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100379endfunc
380
381" Test 'spellsuggest' option with value file:{filename}
382func Test_spellsuggest_option_file()
383 set spell spellsuggest=file:Xspellsuggest
384 call writefile(['emacs/vim',
385 \ 'theribal/terrible',
386 \ 'teribal/terrrible',
387 \ 'terribal'],
388 \ 'Xspellsuggest')
389
390 call assert_equal(['vim'], spellsuggest('emacs', 2))
391 call assert_equal(['terrible'], spellsuggest('theribal',2))
392
393 " If the suggestion is misspelled (*terrrible* with 3 r),
394 " it should not be proposed.
395 " The entry for "terribal" should be ignored because of missing slash.
396 call assert_equal([], spellsuggest('teribal', 2))
397 call assert_equal([], spellsuggest('terribal', 2))
398
399 set spell spellsuggest=best,file:Xspellsuggest
400 call assert_equal(['vim', 'Emacs'], spellsuggest('emacs', 2))
401 call assert_equal(['terrible', 'tribal'], spellsuggest('theribal', 2))
402 call assert_equal(['tribal'], spellsuggest('teribal', 1))
403 call assert_equal(['tribal'], spellsuggest('terribal', 1))
404
405 call delete('Xspellsuggest')
406 call assert_fails("call spellsuggest('vim')", "E484: Can't open file Xspellsuggest")
407
408 set spellsuggest& spell&
409endfunc
410
411" Test 'spellsuggest' option with value {number}
412" to limit the number of suggestions
413func Test_spellsuggest_option_number()
414 set spell spellsuggest=2,best
415 new
416
417 " We limited the number of suggestions to 2, so selecting
418 " the 1st and 2nd suggestion should correct the word, but
419 " selecting a 3rd suggestion should do nothing.
Bram Moolenaar76734052019-12-26 14:30:15 +0100420 call setline(1, 'A baord')
421 norm $1z=
422 call assert_equal('A board', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100423
Bram Moolenaar76734052019-12-26 14:30:15 +0100424 call setline(1, 'A baord')
425 norm $2z=
426 call assert_equal('A bard', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100427
Bram Moolenaar76734052019-12-26 14:30:15 +0100428 call setline(1, 'A baord')
429 norm $3z=
430 call assert_equal('A baord', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100431
Bram Moolenaar76734052019-12-26 14:30:15 +0100432 let a = execute('norm $z=')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100433 call assert_equal(
434 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100435 \ .. "Change \"baord\" to:\n"
436 \ .. " 1 \"board\"\n"
437 \ .. " 2 \"bard\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200438 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100439
440 set spell spellsuggest=0
Bram Moolenaar76734052019-12-26 14:30:15 +0100441 call assert_equal("\nSorry, no suggestions", execute('norm $z='))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100442
443 " Unlike z=, function spellsuggest(...) should not be affected by the
444 " max number of suggestions (2) set by the 'spellsuggest' option.
Bram Moolenaar76734052019-12-26 14:30:15 +0100445 call assert_equal(['board', 'bard', 'broad'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100446
447 set spellsuggest& spell&
448 bwipe!
449endfunc
450
451" Test 'spellsuggest' option with value expr:{expr}
452func Test_spellsuggest_option_expr()
453 " A silly 'spellsuggest' function which makes suggestions all uppercase
454 " and makes the score of each suggestion the length of the suggested word.
455 " So shorter suggestions are preferred.
456 func MySuggest()
457 let spellsuggest_save = &spellsuggest
Bram Moolenaar76734052019-12-26 14:30:15 +0100458 set spellsuggest=3,best
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100459 let result = map(spellsuggest(v:val, 3), "[toupper(v:val), len(v:val)]")
460 let &spellsuggest = spellsuggest_save
461 return result
462 endfunc
463
Bram Moolenaar76734052019-12-26 14:30:15 +0100464 set spell spellsuggest=expr:MySuggest()
465 call assert_equal(['BARD', 'BOARD', 'BROAD'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100466
467 new
Bram Moolenaar76734052019-12-26 14:30:15 +0100468 call setline(1, 'baord')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100469 let a = execute('norm z=')
470 call assert_equal(
471 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100472 \ .. "Change \"baord\" to:\n"
473 \ .. " 1 \"BARD\"\n"
474 \ .. " 2 \"BOARD\"\n"
475 \ .. " 3 \"BROAD\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200476 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100477
478 " With verbose, z= should show the score i.e. word length with
479 " our SpellSuggest() function.
480 set verbose=1
481 let a = execute('norm z=')
482 call assert_equal(
483 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100484 \ .. "Change \"baord\" to:\n"
485 \ .. " 1 \"BARD\" (4 - 0)\n"
486 \ .. " 2 \"BOARD\" (5 - 0)\n"
487 \ .. " 3 \"BROAD\" (5 - 0)\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200488 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100489
490 set spell& spellsuggest& verbose&
491 bwipe!
492endfunc
493
Dominique Pelle81b573d2022-03-22 21:14:55 +0000494" Test for 'spellsuggest' expr errors
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100495func Test_spellsuggest_expr_errors()
496 " 'spellsuggest'
497 func MySuggest()
498 return range(3)
499 endfunc
500 set spell spellsuggest=expr:MySuggest()
501 call assert_equal([], spellsuggest('baord', 3))
502
503 " Test for 'spellsuggest' expression returning a non-list value
504 func! MySuggest2()
505 return 'good'
506 endfunc
507 set spellsuggest=expr:MySuggest2()
508 call assert_equal([], spellsuggest('baord'))
509
510 " Test for 'spellsuggest' expression returning a list with dict values
511 func! MySuggest3()
512 return [[{}, {}]]
513 endfunc
514 set spellsuggest=expr:MySuggest3()
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200515 call assert_fails("call spellsuggest('baord')", 'E731:')
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100516
517 set nospell spellsuggest&
518 delfunc MySuggest
519 delfunc MySuggest2
520 delfunc MySuggest3
521endfunc
522
Bram Moolenaar585ee072022-01-29 11:22:17 +0000523func Test_spellsuggest_timeout()
524 set spellsuggest=timeout:30
525 set spellsuggest=timeout:-123
526 set spellsuggest=timeout:999999
527 call assert_fails('set spellsuggest=timeout', 'E474:')
528 call assert_fails('set spellsuggest=timeout:x', 'E474:')
529 call assert_fails('set spellsuggest=timeout:-x', 'E474:')
530 call assert_fails('set spellsuggest=timeout:--9', 'E474:')
531endfunc
532
Bram Moolenaar5c686172022-03-13 20:12:25 +0000533func Test_spellsuggest_visual_end_of_line()
534 let enc_save = &encoding
535 set encoding=iso8859
536
537 " This was reading beyond the end of the line.
538 norm R00000000000
539 sil norm 0
540 sil! norm i00000)
541 sil! norm i00000)
542 call feedkeys("\<CR>")
543 norm z=
544
545 let &encoding = enc_save
546endfunc
547
Bram Moolenaar9049b682018-08-31 22:26:53 +0200548func Test_spellinfo()
549 new
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200550 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
Bram Moolenaar9049b682018-08-31 22:26:53 +0200551
552 set enc=latin1 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200553 call assert_match("^\nfile: " .. runtime .. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200554
555 set enc=cp1250 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200556 call assert_match("^\nfile: " .. runtime .. "/spell/en.ascii.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200557
Bram Moolenaar30276f22019-01-24 17:59:39 +0100558 set enc=utf-8 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200559 call assert_match("^\nfile: " .. runtime .. "/spell/en.utf-8.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200560
561 set enc=latin1 spell spelllang=en_us,en_nz
562 call assert_match("^\n" .
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200563 \ "file: " .. runtime .. "/spell/en.latin1.spl\n" .
564 \ "file: " .. runtime.. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200565
566 set spell spelllang=
567 call assert_fails('spellinfo', 'E756:')
568
569 set nospell spelllang=en
570 call assert_fails('spellinfo', 'E756:')
571
Bram Moolenaar8f130ed2019-04-10 22:15:19 +0200572 call assert_fails('set spelllang=foo/bar', 'E474:')
573 call assert_fails('set spelllang=foo\ bar', 'E474:')
574 call assert_fails("set spelllang=foo\\\nbar", 'E474:')
575 call assert_fails("set spelllang=foo\\\rbar", 'E474:')
576 call assert_fails("set spelllang=foo+bar", 'E474:')
577
Bram Moolenaar9049b682018-08-31 22:26:53 +0200578 set enc& spell& spelllang&
579 bwipe
580endfunc
581
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200582func Test_zz_basic()
583 call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
584 call RunGoodBad("wrong OK puts. Test the end",
585 \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
586 \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
587 \ "test", "testen", "testn", "the end", "uk", "wrong"],
588 \[
589 \ ["bad", ["put", "uk", "OK"]],
590 \ ["inputs", ["input", "puts", "outputs"]],
591 \ ["comment", ["Comment", "outtest", "the end"]],
592 \ ["ok", ["OK", "uk", "put"]],
593 \ ["Ok", ["OK", "Uk", "Put"]],
594 \ ["test", ["Test", "testn", "testen"]],
595 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
596 \ ["end", ["put", "uk", "test"]],
597 \ ["the", ["put", "uk", "test"]],
598 \ ]
599 \ )
600
601 call assert_equal("gebletegek", soundfold('goobledygoook'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200602 call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200603 call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
604endfunc
605
606" Postponed prefixes
607func Test_zz_prefixes()
608 call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
609 call RunGoodBad("puts",
610 \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
611 \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
612 \ [
613 \ ["bad", ["put", "uk", "OK"]],
614 \ ["inputs", ["input", "puts", "outputs"]],
615 \ ["comment", ["Comment"]],
616 \ ["ok", ["OK", "uk", "put"]],
617 \ ["Ok", ["OK", "Uk", "Put"]],
618 \ ["end", ["put", "uk", "deol"]],
619 \ ["the", ["put", "uk", "test"]],
620 \ ["test", ["Test", "testn", "testen"]],
621 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
622 \ ])
623endfunc
624
625"Compound words
626func Test_zz_compound()
627 call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
628 call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
629 \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
630 \ ["foo", "m\xEF"],
631 \ [
632 \ ["bad", ["foo", "m\xEF"]],
633 \ ["bar", ["barfoo", "foobar", "foo"]],
634 \ ["la", ["m\xEF", "foo"]],
635 \ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
636 \ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
637 \ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
638 \ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
639 \ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
640 \ ["lala", []],
641 \ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
642 \ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
643 \ ["foola", ["foo", "foobar", "foofoo"]],
644 \ ["labar", ["barbar", "foobar"]],
645 \ ])
646
647 call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
648 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",
649 \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword",
650 \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
651 \ [
652 \ ["bad", ["end", "bork", "word"]],
653 \ ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
654 \ ["pro", ["bork", "word", "end"]],
655 \ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
656 \ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
657 \ ["endstart", ["end start", "start"]],
658 \ ["endend", ["end end", "end"]],
659 \ ["startstart", ["start start"]],
660 \ ["wordend", ["word end", "word", "wordword"]],
661 \ ["wordstart", ["word start", "bork start"]],
662 \ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
663 \ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
664 \ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
665 \ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
666 \ ["utilsbork", ["utilbork", "utils bork", "util bork"]],
667 \ ["startnouword", ["start nouword", "startword", "startborkword"]],
668 \ ])
669
670endfunc
671
672"Test affix flags with two characters
673func Test_zz_affix()
674 call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
675 call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend",
676 \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
677 \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
678 \ [
679 \ ["bad", ["bar", "end", "fooa1"]],
680 \ ["foo", ["fooa1", "fooa\xE9", "bar"]],
681 \ ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
682 \ ["prabar", ["prebar", "bar", "bar bar"]],
683 \ ["probarbirk", ["prebarbork"]],
684 \ ["middle", []],
685 \ ["startmiddle", ["startmiddleend", "startmiddlebar"]],
686 \ ["middleend", []],
687 \ ["endstart", ["end start", "start"]],
688 \ ["startprobar", ["startprebar", "start prebar", "startbar"]],
689 \ ["startnouend", ["start nouend", "startend"]],
690 \ ])
691
692 call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
693 call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend",
694 \ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
695 \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
696 \ [
697 \ ["bad", ["bar", "end", "lead"]],
698 \ ["mee", ["meea1", "meea\xE9", "bar"]],
699 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
700 \ ["prabar", ["prebar", "bar", "leadbar"]],
701 \ ["probarbirk", ["prebarbork"]],
702 \ ["middle", []],
703 \ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
704 \ ["middleend", []],
705 \ ["endlead", ["end lead", "lead", "end end"]],
706 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
707 \ ])
708
709 call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100710 call RunGoodBad("meea1 meezero meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200711 \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100712 \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "meezero", "prebar", "prebarmeat", "tail"],
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200713 \ [
714 \ ["bad", ["bar", "lead", "tail"]],
715 \ ["mee", ["meea1", "meea\xE9", "bar"]],
716 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
717 \ ["prabar", ["prebar", "bar", "leadbar"]],
718 \ ["probarmaat", ["prebarmeat"]],
719 \ ["middle", []],
720 \ ["leadmiddle", ["leadmiddlebar"]],
721 \ ["middletail", []],
722 \ ["taillead", ["tail lead", "tail"]],
723 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
724 \ ])
725endfunc
726
727func Test_zz_NOSLITSUGS()
728 call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
729 call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
730 \ ["bar", "faabar", "foo"],
731 \ [
732 \ ["bad", ["bar", "foo"]],
733 \ ["foobar", ["faabar", "foo bar", "bar"]],
734 \ ["barfoo", ["bar foo", "bar", "foo"]],
735 \ ])
736endfunc
737
738" Numbers
739func Test_zz_Numbers()
740 call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
741 call RunGoodBad("0b1011 0777 1234 0x01ff", "",
742 \ ["bar", "foo"],
743 \ [
744 \ ])
745endfunc
746
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +0100747" Affix flags
748func Test_zz_affix_flags()
749 call LoadAffAndDic(g:test_data_aff10, g:test_data_dic10)
750 call RunGoodBad("drink drinkable drinkables drinktable drinkabletable",
751 \ "bad: drinks drinkstable drinkablestable",
752 \ ["drink", "drinkable", "drinkables", "table"],
753 \ [['bad', []],
754 \ ['drinks', ['drink']],
755 \ ['drinkstable', ['drinktable', 'drinkable', 'drink table']],
756 \ ['drinkablestable', ['drinkabletable', 'drinkables table', 'drinkable table']],
757 \ ])
758endfunc
759
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200760function FirstSpellWord()
761 call feedkeys("/^start:\n", 'tx')
762 normal ]smm
763 let [str, a] = spellbadword()
764 return str
765endfunc
766
767function SecondSpellWord()
768 normal `m]s
769 let [str, a] = spellbadword()
770 return str
771endfunc
772
773"Test with SAL instead of SOFO items; test automatic reloading
774func Test_zz_sal_and_addition()
775 set enc=latin1
776 set spellfile=
Bram Moolenaar56564962022-10-10 22:39:42 +0100777 call writefile(g:test_data_dic1, "Xtest.dic", 'D')
778 call writefile(g:test_data_aff_sal, "Xtest.aff", 'D')
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200779 mkspell! Xtest Xtest
780 set spl=Xtest.latin1.spl spell
781 call assert_equal('kbltykk', soundfold('goobledygoook'))
782 call assert_equal('kprnfn', soundfold('kóopërÿnôven'))
783 call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
784
785 "also use an addition file
Bram Moolenaar56564962022-10-10 22:39:42 +0100786 call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add", 'D')
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200787 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
788
789 bwipe!
790 call setline(1, ["start: elequint test elekwint test elekwent asdf"])
791
792 set spellfile=Xtest.latin1.add
793 call assert_equal("elekwent", FirstSpellWord())
794
795 set spl=Xtest_us.latin1.spl
796 call assert_equal("elequint", FirstSpellWord())
797 call assert_equal("elekwint", SecondSpellWord())
798
799 set spl=Xtest_gb.latin1.spl
800 call assert_equal("elekwint", FirstSpellWord())
801 call assert_equal("elekwent", SecondSpellWord())
802
803 set spl=Xtest_nz.latin1.spl
804 call assert_equal("elequint", FirstSpellWord())
805 call assert_equal("elekwent", SecondSpellWord())
806
807 set spl=Xtest_ca.latin1.spl
808 call assert_equal("elequint", FirstSpellWord())
809 call assert_equal("elekwint", SecondSpellWord())
zeertzjq288ed232022-07-04 11:03:07 +0100810
811 bwipe!
812 set spellfile=
813 set spl&
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200814endfunc
815
Bram Moolenaar862f1e12019-04-10 22:33:41 +0200816func Test_spellfile_value()
817 set spellfile=Xdir/Xtest.latin1.add
818 set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
819endfunc
820
Bram Moolenaaree03b942017-10-27 00:57:05 +0200821func Test_region_error()
822 messages clear
Bram Moolenaar56564962022-10-10 22:39:42 +0100823 call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add", 'D')
Bram Moolenaaree03b942017-10-27 00:57:05 +0200824 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
825 call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
Bram Moolenaaree03b942017-10-27 00:57:05 +0200826 call delete('Xtest.latin1.add.spl')
827endfunc
828
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200829" Check using z= in new buffer (crash fixed by patch 7.4a.028).
830func Test_zeq_crash()
831 new
832 set maxmem=512 spell
833 call feedkeys('iasdz=:\"', 'tx')
834
835 bwipe!
836endfunc
837
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200838" Check that z= works even when 'nospell' is set. This test uses one of the
839" tests in Test_spellsuggest_option_number() just to verify that z= basically
840" works and that "E756: Spell checking is not enabled" is not generated.
841func Test_zeq_nospell()
842 new
843 set nospell spellsuggest=1,best
844 call setline(1, 'A baord')
845 try
846 norm $1z=
847 call assert_equal('A board', getline(1))
848 catch
849 call assert_report("Caught exception: " . v:exception)
850 endtry
851 set spell& spellsuggest&
852 bwipe!
853endfunc
854
855" Check that "E756: Spell checking is not possible" is reported when z= is
856" executed and 'spelllang' is empty.
857func Test_zeq_no_spelllang()
858 new
859 set spelllang= spellsuggest=1,best
860 call setline(1, 'A baord')
861 call assert_fails('normal $1z=', 'E756:')
862 set spelllang& spellsuggest&
863 bwipe!
864endfunc
865
Bram Moolenaar5bcc5a12019-08-06 22:48:02 +0200866" Check handling a word longer than MAXWLEN.
867func Test_spell_long_word()
868 set enc=utf-8
869 new
870 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")
871 set spell spelllang=en
872 redraw
873 redraw!
874 bwipe!
875 set nospell
876endfunc
877
Bram Moolenaar06f15412022-01-29 10:51:59 +0000878func Test_spellsuggest_too_deep()
879 " This was incrementing "depth" over MAXWLEN.
880 new
881 norm s000G00ý000000000000
882 sil norm ..vzG................vvzG0 v z=
883 bwipe!
884endfunc
885
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100886func Test_spell_good_word_invalid()
887 " This was adding a word with a 0x02 byte, which causes havoc.
888 enew
889 norm o0
890 sil! norm rzzWs00/
891 2
892 sil! norm VzGprzzW
893 sil! norm z=
894
895 bwipe!
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100896endfunc
897
K.Takata2ebcc352022-07-14 17:25:14 +0100898func Test_spell_good_word_slash()
899 " This caused E1280.
900 new
901 norm afoo /
902 1
903 norm zG
904
905 bwipe!
906endfunc
907
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200908func LoadAffAndDic(aff_contents, dic_contents)
909 set enc=latin1
910 set spellfile=
911 call writefile(a:aff_contents, "Xtest.aff")
912 call writefile(a:dic_contents, "Xtest.dic")
913 " Generate a .spl file from a .dic and .aff file.
914 mkspell! Xtest Xtest
915 " use that spell file
916 set spl=Xtest.latin1.spl spell
917endfunc
918
919func ListWords()
920 spelldump
921 %yank
922 quit
923 return split(@", "\n")
924endfunc
925
926func TestGoodBadBase()
927 exe '1;/^good:'
928 normal 0f:]s
929 let prevbad = ''
930 let result = []
931 while 1
932 let [bad, a] = spellbadword()
933 if bad == '' || bad == prevbad || bad == 'badend'
934 break
935 endif
936 let prevbad = bad
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200937 let lst = bad->spellsuggest(3)
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200938 normal mm
939
940 call add(result, [bad, lst])
941 normal `m]s
942 endwhile
943 return result
944endfunc
945
946func RunGoodBad(good, bad, expected_words, expected_bad_words)
947 bwipe!
948 call setline(1, ["good: ", a:good, a:bad, " badend "])
949 let words = ListWords()
950 call assert_equal(a:expected_words, words[1:-1])
951 let bad_words = TestGoodBadBase()
952 call assert_equal(a:expected_bad_words, bad_words)
953 bwipe!
954endfunc
955
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200956func Test_spell_screendump()
957 CheckScreendump
958
959 let lines =<< trim END
Luuk van Baale84c7732023-05-31 18:57:36 +0100960 call test_override('alloc_lines', 1)
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200961 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
Luuk van Baale84c7732023-05-31 18:57:36 +0100983 call test_override('alloc_lines', 1)
Christian Brabandtafa23d12022-08-09 12:25:10 +0100984 call setline(1, [
985 \ " This line has a sepll error. and missing caps and trailing spaces. ",
986 \ "another missing cap here.",
987 \ "",
988 \ "and here.",
989 \ " ",
990 \ "and here."
991 \ ])
992 set spell spelllang=en
993 END
Bram Moolenaarf3ef0262022-10-05 13:29:15 +0100994 call writefile(lines, 'XtestSpellCap', 'D')
Christian Brabandtafa23d12022-08-09 12:25:10 +0100995 let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8})
996 call VerifyScreenDump(buf, 'Test_spell_2', {})
997
Bram Moolenaaree09fcc2022-09-25 20:58:30 +0100998 " After adding word missing Cap in next line is updated
999 call term_sendkeys(buf, "3GANot\<Esc>")
1000 call VerifyScreenDump(buf, 'Test_spell_3', {})
1001
Bram Moolenaar26f09ea2022-09-27 16:29:38 +01001002 " Deleting a full stop removes missing Cap in next line
Luuk van Baal2ac64972023-05-25 17:14:42 +01001003 call term_sendkeys(buf, "5Gdd\<C-L>k$x")
Bram Moolenaar26f09ea2022-09-27 16:29:38 +01001004 call VerifyScreenDump(buf, 'Test_spell_4', {})
1005
1006 " Undo also updates the next line (go to command line to remove message)
1007 call term_sendkeys(buf, "u:\<Esc>")
1008 call VerifyScreenDump(buf, 'Test_spell_5', {})
1009
Luuk van Baal2ac64972023-05-25 17:14:42 +01001010 " Folding an empty line does not remove Cap in next line
1011 call term_sendkeys(buf, "uzfk:\<Esc>")
1012 call VerifyScreenDump(buf, 'Test_spell_6', {})
1013
1014 " Folding the end of a sentence does not remove Cap in next line
1015 " and editing a line does not remove Cap in current line
1016 call term_sendkeys(buf, "Jzfkk$x")
1017 call VerifyScreenDump(buf, 'Test_spell_7', {})
1018
1019 " Cap is correctly applied in the first row of a window
1020 call term_sendkeys(buf, "\<C-E>\<C-L>")
1021 call VerifyScreenDump(buf, 'Test_spell_8', {})
1022
Luuk van Baale84c7732023-05-31 18:57:36 +01001023 " Adding an empty line does not remove Cap in "mod_bot" area
1024 call term_sendkeys(buf, "zbO\<Esc>")
1025 call VerifyScreenDump(buf, 'Test_spell_9', {})
1026
1027 " Multiple empty lines does not remove Cap in the line after
1028 call term_sendkeys(buf, "O\<Esc>\<C-L>")
1029 call VerifyScreenDump(buf, 'Test_spell_10', {})
1030
Christian Brabandtafa23d12022-08-09 12:25:10 +01001031 " clean up
1032 call StopVimInTerminal(buf)
Bram Moolenaarf3ef0262022-10-05 13:29:15 +01001033endfunc
1034
1035func Test_spell_compatible()
1036 CheckScreendump
1037
1038 let lines =<< trim END
Luuk van Baale84c7732023-05-31 18:57:36 +01001039 call test_override('alloc_lines', 1)
Bram Moolenaarf3ef0262022-10-05 13:29:15 +01001040 call setline(1, [
1041 \ "test "->repeat(20),
1042 \ "",
1043 \ "end",
1044 \ ])
1045 set spell cpo+=$
1046 END
1047 call writefile(lines, 'XtestSpellComp', 'D')
1048 let buf = RunVimInTerminal('-S XtestSpellComp', {'rows': 8})
1049
1050 call term_sendkeys(buf, "51|C")
1051 call VerifyScreenDump(buf, 'Test_spell_compatible_1', {})
1052
1053 call term_sendkeys(buf, "x")
1054 call VerifyScreenDump(buf, 'Test_spell_compatible_2', {})
1055
1056 " clean up
1057 call StopVimInTerminal(buf)
Christian Brabandtafa23d12022-08-09 12:25:10 +01001058endfunc
1059
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001060let g:test_data_aff1 = [
1061 \"SET ISO8859-1",
1062 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1063 \"",
1064 \"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",
1065 \"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",
1066 \"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",
1067 \"",
1068 \"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",
1069 \"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
1070 \"",
1071 \"MIDWORD\t'-",
1072 \"",
1073 \"KEP =",
1074 \"RAR ?",
1075 \"BAD !",
1076 \"",
1077 \"PFX I N 1",
1078 \"PFX I 0 in .",
1079 \"",
1080 \"PFX O Y 1",
1081 \"PFX O 0 out .",
1082 \"",
1083 \"SFX S Y 2",
1084 \"SFX S 0 s [^s]",
1085 \"SFX S 0 es s",
1086 \"",
1087 \"SFX N N 3",
1088 \"SFX N 0 en [^n]",
1089 \"SFX N 0 nen n",
1090 \"SFX N 0 n .",
1091 \"",
1092 \"REP 3",
1093 \"REP g ch",
1094 \"REP ch g",
1095 \"REP svp s.v.p.",
1096 \"",
1097 \"MAP 9",
1098 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1099 \"MAP e\xE8\xE9\xEA\xEB",
1100 \"MAP i\xEC\xED\xEE\xEF",
1101 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1102 \"MAP u\xF9\xFA\xFB\xFC",
1103 \"MAP n\xF1",
1104 \"MAP c\xE7",
1105 \"MAP y\xFF\xFD",
1106 \"MAP s\xDF",
1107 \ ]
1108let g:test_data_dic1 = [
1109 \"123456",
1110 \"test/NO",
1111 \"# comment",
1112 \"wrong",
1113 \"Comment",
1114 \"OK",
1115 \"uk",
1116 \"put/ISO",
1117 \"the end",
1118 \"deol",
1119 \"d\xE9\xF4r",
1120 \ ]
1121let g:test_data_aff2 = [
1122 \"SET ISO8859-1",
1123 \"",
1124 \"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",
1125 \"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",
1126 \"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",
1127 \"",
1128 \"PFXPOSTPONE",
1129 \"",
1130 \"MIDWORD\t'-",
1131 \"",
1132 \"KEP =",
1133 \"RAR ?",
1134 \"BAD !",
1135 \"",
1136 \"PFX I N 1",
1137 \"PFX I 0 in .",
1138 \"",
1139 \"PFX O Y 1",
1140 \"PFX O 0 out [a-z]",
1141 \"",
1142 \"SFX S Y 2",
1143 \"SFX S 0 s [^s]",
1144 \"SFX S 0 es s",
1145 \"",
1146 \"SFX N N 3",
1147 \"SFX N 0 en [^n]",
1148 \"SFX N 0 nen n",
1149 \"SFX N 0 n .",
1150 \"",
1151 \"REP 3",
1152 \"REP g ch",
1153 \"REP ch g",
1154 \"REP svp s.v.p.",
1155 \"",
1156 \"MAP 9",
1157 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1158 \"MAP e\xE8\xE9\xEA\xEB",
1159 \"MAP i\xEC\xED\xEE\xEF",
1160 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1161 \"MAP u\xF9\xFA\xFB\xFC",
1162 \"MAP n\xF1",
1163 \"MAP c\xE7",
1164 \"MAP y\xFF\xFD",
1165 \"MAP s\xDF",
1166 \ ]
1167let g:test_data_aff3 = [
1168 \"SET ISO8859-1",
1169 \"",
1170 \"COMPOUNDMIN 3",
1171 \"COMPOUNDRULE m*",
1172 \"NEEDCOMPOUND x",
1173 \ ]
1174let g:test_data_dic3 = [
1175 \"1234",
1176 \"foo/m",
1177 \"bar/mx",
1178 \"m\xEF/m",
1179 \"la/mx",
1180 \ ]
1181let g:test_data_aff4 = [
1182 \"SET ISO8859-1",
1183 \"",
1184 \"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",
1185 \"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",
1186 \"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",
1187 \"",
1188 \"COMPOUNDRULE m+",
1189 \"COMPOUNDRULE sm*e",
1190 \"COMPOUNDRULE sm+",
1191 \"COMPOUNDMIN 3",
1192 \"COMPOUNDWORDMAX 3",
1193 \"COMPOUNDFORBIDFLAG t",
1194 \"",
1195 \"COMPOUNDSYLMAX 5",
1196 \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
1197 \"",
1198 \"MAP 9",
1199 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1200 \"MAP e\xE8\xE9\xEA\xEB",
1201 \"MAP i\xEC\xED\xEE\xEF",
1202 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1203 \"MAP u\xF9\xFA\xFB\xFC",
1204 \"MAP n\xF1",
1205 \"MAP c\xE7",
1206 \"MAP y\xFF\xFD",
1207 \"MAP s\xDF",
1208 \"",
1209 \"NEEDAFFIX x",
1210 \"",
1211 \"PFXPOSTPONE",
1212 \"",
1213 \"MIDWORD '-",
1214 \"",
1215 \"SFX q N 1",
1216 \"SFX q 0 -ok .",
1217 \"",
1218 \"SFX a Y 2",
1219 \"SFX a 0 s .",
1220 \"SFX a 0 ize/t .",
1221 \"",
1222 \"PFX p N 1",
1223 \"PFX p 0 pre .",
1224 \"",
1225 \"PFX P N 1",
1226 \"PFX P 0 nou .",
1227 \ ]
1228let g:test_data_dic4 = [
1229 \"1234",
1230 \"word/mP",
1231 \"util/am",
1232 \"pro/xq",
1233 \"tomato/m",
1234 \"bork/mp",
1235 \"start/s",
1236 \"end/e",
1237 \ ]
1238let g:test_data_aff5 = [
1239 \"SET ISO8859-1",
1240 \"",
1241 \"FLAG long",
1242 \"",
1243 \"NEEDAFFIX !!",
1244 \"",
1245 \"COMPOUNDRULE ssmm*ee",
1246 \"",
1247 \"NEEDCOMPOUND xx",
1248 \"COMPOUNDPERMITFLAG pp",
1249 \"",
1250 \"SFX 13 Y 1",
1251 \"SFX 13 0 bork .",
1252 \"",
1253 \"SFX a1 Y 1",
1254 \"SFX a1 0 a1 .",
1255 \"",
1256 \"SFX a\xE9 Y 1",
1257 \"SFX a\xE9 0 a\xE9 .",
1258 \"",
1259 \"PFX zz Y 1",
1260 \"PFX zz 0 pre/pp .",
1261 \"",
1262 \"PFX yy Y 1",
1263 \"PFX yy 0 nou .",
1264 \ ]
1265let g:test_data_dic5 = [
1266 \"1234",
1267 \"foo/a1a\xE9!!",
1268 \"bar/zz13ee",
1269 \"start/ss",
1270 \"end/eeyy",
1271 \"middle/mmxx",
1272 \ ]
1273let g:test_data_aff6 = [
1274 \"SET ISO8859-1",
1275 \"",
1276 \"FLAG caplong",
1277 \"",
1278 \"NEEDAFFIX A!",
1279 \"",
1280 \"COMPOUNDRULE sMm*Ee",
1281 \"",
1282 \"NEEDCOMPOUND Xx",
1283 \"",
1284 \"COMPOUNDPERMITFLAG p",
1285 \"",
1286 \"SFX N3 Y 1",
1287 \"SFX N3 0 bork .",
1288 \"",
1289 \"SFX A1 Y 1",
1290 \"SFX A1 0 a1 .",
1291 \"",
1292 \"SFX A\xE9 Y 1",
1293 \"SFX A\xE9 0 a\xE9 .",
1294 \"",
1295 \"PFX Zz Y 1",
1296 \"PFX Zz 0 pre/p .",
1297 \ ]
1298let g:test_data_dic6 = [
1299 \"1234",
1300 \"mee/A1A\xE9A!",
1301 \"bar/ZzN3Ee",
1302 \"lead/s",
1303 \"end/Ee",
1304 \"middle/MmXx",
1305 \ ]
1306let g:test_data_aff7 = [
1307 \"SET ISO8859-1",
1308 \"",
1309 \"FLAG num",
1310 \"",
1311 \"NEEDAFFIX 9999",
1312 \"",
1313 \"COMPOUNDRULE 2,77*123",
1314 \"",
1315 \"NEEDCOMPOUND 1",
1316 \"COMPOUNDPERMITFLAG 432",
1317 \"",
1318 \"SFX 61003 Y 1",
1319 \"SFX 61003 0 meat .",
1320 \"",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001321 \"SFX 0 Y 1",
1322 \"SFX 0 0 zero .",
1323 \"",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001324 \"SFX 391 Y 1",
1325 \"SFX 391 0 a1 .",
1326 \"",
1327 \"SFX 111 Y 1",
1328 \"SFX 111 0 a\xE9 .",
1329 \"",
1330 \"PFX 17 Y 1",
1331 \"PFX 17 0 pre/432 .",
1332 \ ]
1333let g:test_data_dic7 = [
1334 \"1234",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001335 \"mee/0,391,111,9999",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001336 \"bar/17,61003,123",
1337 \"lead/2",
1338 \"tail/123",
1339 \"middle/77,1",
1340 \ ]
1341let g:test_data_aff8 = [
1342 \"SET ISO8859-1",
1343 \"",
1344 \"NOSPLITSUGS",
1345 \ ]
1346let g:test_data_dic8 = [
1347 \"1234",
1348 \"foo",
1349 \"bar",
1350 \"faabar",
1351 \ ]
1352let g:test_data_aff9 = [
1353 \ ]
1354let g:test_data_dic9 = [
1355 \"1234",
1356 \"foo",
1357 \"bar",
1358 \ ]
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +01001359let g:test_data_aff10 = [
1360 \"COMPOUNDRULE se",
1361 \"COMPOUNDPERMITFLAG p",
1362 \"",
1363 \"SFX A Y 1",
1364 \"SFX A 0 able/Mp .",
1365 \"",
1366 \"SFX M Y 1",
1367 \"SFX M 0 s .",
1368 \ ]
1369let g:test_data_dic10 = [
1370 \"1234",
1371 \"drink/As",
1372 \"table/e",
1373 \ ]
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001374let g:test_data_aff_sal = [
1375 \"SET ISO8859-1",
1376 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1377 \"",
1378 \"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",
1379 \"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",
1380 \"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",
1381 \"",
1382 \"MIDWORD\t'-",
1383 \"",
1384 \"KEP =",
1385 \"RAR ?",
1386 \"BAD !",
1387 \"",
1388 \"PFX I N 1",
1389 \"PFX I 0 in .",
1390 \"",
1391 \"PFX O Y 1",
1392 \"PFX O 0 out .",
1393 \"",
1394 \"SFX S Y 2",
1395 \"SFX S 0 s [^s]",
1396 \"SFX S 0 es s",
1397 \"",
1398 \"SFX N N 3",
1399 \"SFX N 0 en [^n]",
1400 \"SFX N 0 nen n",
1401 \"SFX N 0 n .",
1402 \"",
1403 \"REP 3",
1404 \"REP g ch",
1405 \"REP ch g",
1406 \"REP svp s.v.p.",
1407 \"",
1408 \"MAP 9",
1409 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1410 \"MAP e\xE8\xE9\xEA\xEB",
1411 \"MAP i\xEC\xED\xEE\xEF",
1412 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1413 \"MAP u\xF9\xFA\xFB\xFC",
1414 \"MAP n\xF1",
1415 \"MAP c\xE7",
1416 \"MAP y\xFF\xFD",
1417 \"MAP s\xDF",
1418 \"",
1419 \"SAL AH(AEIOUY)-^ *H",
1420 \"SAL AR(AEIOUY)-^ *R",
1421 \"SAL A(HR)^ *",
1422 \"SAL A^ *",
1423 \"SAL AH(AEIOUY)- H",
1424 \"SAL AR(AEIOUY)- R",
1425 \"SAL A(HR) _",
1426 \"SAL \xC0^ *",
1427 \"SAL \xC5^ *",
1428 \"SAL BB- _",
1429 \"SAL B B",
1430 \"SAL CQ- _",
1431 \"SAL CIA X",
1432 \"SAL CH X",
1433 \"SAL C(EIY)- S",
1434 \"SAL CK K",
1435 \"SAL COUGH^ KF",
1436 \"SAL CC< C",
1437 \"SAL C K",
1438 \"SAL DG(EIY) K",
1439 \"SAL DD- _",
1440 \"SAL D T",
1441 \"SAL \xC9< E",
1442 \"SAL EH(AEIOUY)-^ *H",
1443 \"SAL ER(AEIOUY)-^ *R",
1444 \"SAL E(HR)^ *",
1445 \"SAL ENOUGH^$ *NF",
1446 \"SAL E^ *",
1447 \"SAL EH(AEIOUY)- H",
1448 \"SAL ER(AEIOUY)- R",
1449 \"SAL E(HR) _",
1450 \"SAL FF- _",
1451 \"SAL F F",
1452 \"SAL GN^ N",
1453 \"SAL GN$ N",
1454 \"SAL GNS$ NS",
1455 \"SAL GNED$ N",
1456 \"SAL GH(AEIOUY)- K",
1457 \"SAL GH _",
1458 \"SAL GG9 K",
1459 \"SAL G K",
1460 \"SAL H H",
1461 \"SAL IH(AEIOUY)-^ *H",
1462 \"SAL IR(AEIOUY)-^ *R",
1463 \"SAL I(HR)^ *",
1464 \"SAL I^ *",
1465 \"SAL ING6 N",
1466 \"SAL IH(AEIOUY)- H",
1467 \"SAL IR(AEIOUY)- R",
1468 \"SAL I(HR) _",
1469 \"SAL J K",
1470 \"SAL KN^ N",
1471 \"SAL KK- _",
1472 \"SAL K K",
1473 \"SAL LAUGH^ LF",
1474 \"SAL LL- _",
1475 \"SAL L L",
1476 \"SAL MB$ M",
1477 \"SAL MM M",
1478 \"SAL M M",
1479 \"SAL NN- _",
1480 \"SAL N N",
1481 \"SAL OH(AEIOUY)-^ *H",
1482 \"SAL OR(AEIOUY)-^ *R",
1483 \"SAL O(HR)^ *",
1484 \"SAL O^ *",
1485 \"SAL OH(AEIOUY)- H",
1486 \"SAL OR(AEIOUY)- R",
1487 \"SAL O(HR) _",
1488 \"SAL PH F",
1489 \"SAL PN^ N",
1490 \"SAL PP- _",
1491 \"SAL P P",
1492 \"SAL Q K",
1493 \"SAL RH^ R",
1494 \"SAL ROUGH^ RF",
1495 \"SAL RR- _",
1496 \"SAL R R",
1497 \"SAL SCH(EOU)- SK",
1498 \"SAL SC(IEY)- S",
1499 \"SAL SH X",
1500 \"SAL SI(AO)- X",
1501 \"SAL SS- _",
1502 \"SAL S S",
1503 \"SAL TI(AO)- X",
1504 \"SAL TH @",
1505 \"SAL TCH-- _",
1506 \"SAL TOUGH^ TF",
1507 \"SAL TT- _",
1508 \"SAL T T",
1509 \"SAL UH(AEIOUY)-^ *H",
1510 \"SAL UR(AEIOUY)-^ *R",
1511 \"SAL U(HR)^ *",
1512 \"SAL U^ *",
1513 \"SAL UH(AEIOUY)- H",
1514 \"SAL UR(AEIOUY)- R",
1515 \"SAL U(HR) _",
1516 \"SAL V^ W",
1517 \"SAL V F",
1518 \"SAL WR^ R",
1519 \"SAL WH^ W",
1520 \"SAL W(AEIOU)- W",
1521 \"SAL X^ S",
1522 \"SAL X KS",
1523 \"SAL Y(AEIOU)- Y",
1524 \"SAL ZZ- _",
1525 \"SAL Z S",
1526 \ ]
Bram Moolenaar0e05de42020-03-25 22:23:46 +01001527
1528" vim: shiftwidth=2 sts=2 expandtab