blob: be0bc55810f0e305b85f34d19303d97ff24efa26 [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
LemonBoyd0874502023-08-27 21:52:27 +0200135func Test_spell_camelcase()
136 set spell spelloptions=camel
137 let words = [
138 \ 'UPPER',
139 \ 'lower',
140 \ 'mixedCase',
141 \ 'HTML',
142 \ 'XMLHttpRequest',
143 \ 'foo123bar',
144 \ '12345678',
145 \ 'HELLO123world',
146 \]
147
148 for word in words
149 call assert_equal(['', ''], spellbadword(word))
150 endfor
151
152 set spell& spelloptions&
153endfunc
154
Bram Moolenaard569a9e2020-09-28 23:13:15 +0200155func Test_spell_file_missing()
156 let s:spell_file_missing = 0
157 augroup TestSpellFileMissing
158 autocmd! SpellFileMissing * let s:spell_file_missing += 1
159 augroup END
160
161 set spell spelllang=ab_cd
162 let messages = GetMessages()
163 call assert_equal('Warning: Cannot find word list "ab.utf-8.spl" or "ab.ascii.spl"', messages[-1])
164 call assert_equal(1, s:spell_file_missing)
165
166 new XTestSpellFileMissing
167 augroup TestSpellFileMissing
168 autocmd! SpellFileMissing * bwipe
169 augroup END
Bram Moolenaar371951d2022-09-28 14:08:23 +0100170 call assert_fails('set spell spelllang=ab_cd', 'E937:')
Bram Moolenaard569a9e2020-09-28 23:13:15 +0200171
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100172 " clean up
173 augroup TestSpellFileMissing
174 autocmd! SpellFileMissing
175 augroup END
Bram Moolenaard569a9e2020-09-28 23:13:15 +0200176 augroup! TestSpellFileMissing
177 unlet s:spell_file_missing
178 set spell& spelllang&
179 %bwipe!
180endfunc
181
Bram Moolenaarc3d27ad2022-11-14 20:52:14 +0000182func Test_spell_file_missing_bwipe()
183 " this was using a window that was wiped out in a SpellFileMissing autocmd
184 set spelllang=xy
185 au SpellFileMissing * n0
186 set spell
187 au SpellFileMissing * bw
188 snext somefile
189
190 au! SpellFileMissing
191 bwipe!
192 set nospell spelllang=en
193endfunc
194
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200195func Test_spelldump()
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100196 " In case the spell file is not found avoid getting the download dialog, we
197 " would get stuck at the prompt.
198 let g:en_not_found = 0
199 augroup TestSpellFileMissing
200 au! SpellFileMissing * let g:en_not_found = 1
201 augroup END
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200202 set spell spelllang=en
203 spellrare! emacs
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100204 if g:en_not_found
205 call assert_report("Could not find English spell file")
206 else
207 spelldump
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200208
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100209 " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
210 call assert_equal('/regions=usaucagbnz', getline(1))
211 call assert_notequal(0, search('^theater/1$')) " US English only.
212 call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English.
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200213
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100214 call assert_notequal(0, search('^emacs/?$')) " ? for a rare word.
215 call assert_notequal(0, search('^the the/!$')) " ! for a wrong word.
216 endif
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200217
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100218 " clean up
219 unlet g:en_not_found
220 augroup TestSpellFileMissing
221 autocmd! SpellFileMissing
222 augroup END
223 augroup! TestSpellFileMissing
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200224 bwipe
225 set spell&
226endfunc
227
228func Test_spelldump_bang()
229 new
230 call setline(1, 'This is a sample sentence.')
231 redraw
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100232
233 " In case the spell file is not found avoid getting the download dialog, we
234 " would get stuck at the prompt.
235 let g:en_not_found = 0
236 augroup TestSpellFileMissing
237 au! SpellFileMissing * let g:en_not_found = 1
238 augroup END
239
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200240 set spell
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200241
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100242 if g:en_not_found
243 call assert_report("Could not find English spell file")
244 else
245 redraw
246 spelldump!
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200247
Bram Moolenaarfc9f0fd2022-06-15 16:57:44 +0100248 " :spelldump! includes the number of times a word was found while updating
249 " the screen.
250 " Common word count starts at 10, regular word count starts at 0.
251 call assert_notequal(0, search("^is\t11$")) " common word found once.
252 call assert_notequal(0, search("^the\t10$")) " common word never found.
253 call assert_notequal(0, search("^sample\t1$")) " regular word found once.
254 call assert_equal(0, search("^screen\t")) " regular word never found.
255 endif
256
257 " clean up
258 unlet g:en_not_found
259 augroup TestSpellFileMissing
260 autocmd! SpellFileMissing
261 augroup END
262 augroup! TestSpellFileMissing
Bram Moolenaarf12f0022020-10-07 12:58:44 +0200263 %bwipe!
264 set spell&
265endfunc
266
Bram Moolenaar8c7ad362020-09-27 13:58:38 +0200267func Test_spelllang_inv_region()
268 set spell spelllang=en_xx
269 let messages = GetMessages()
270 call assert_equal('Warning: region xx not supported', messages[-1])
271 set spell& spelllang&
272endfunc
273
274func Test_compl_with_CTRL_X_CTRL_K_using_spell()
275 " When spell checking is enabled and 'dictionary' is empty,
276 " CTRL-X CTRL-K in insert mode completes using the spelling dictionary.
277 new
278 set spell spelllang=en dictionary=
279
280 set ignorecase
281 call feedkeys("Senglis\<c-x>\<c-k>\<esc>", 'tnx')
282 call assert_equal(['English'], getline(1, '$'))
283 call feedkeys("SEnglis\<c-x>\<c-k>\<esc>", 'tnx')
284 call assert_equal(['English'], getline(1, '$'))
285
286 set noignorecase
287 call feedkeys("Senglis\<c-x>\<c-k>\<esc>", 'tnx')
288 call assert_equal(['englis'], getline(1, '$'))
289 call feedkeys("SEnglis\<c-x>\<c-k>\<esc>", 'tnx')
290 call assert_equal(['English'], getline(1, '$'))
291
292 set spelllang=en_us
293 call feedkeys("Stheat\<c-x>\<c-k>\<esc>", 'tnx')
294 call assert_equal(['theater'], getline(1, '$'))
295 set spelllang=en_gb
296 call feedkeys("Stheat\<c-x>\<c-k>\<esc>", 'tnx')
LemonBoye98fb642023-08-15 23:07:55 +0200297 call assert_equal(['theatre'], getline(1, '$'))
Bram Moolenaar8c7ad362020-09-27 13:58:38 +0200298
299 bwipe!
300 set spell& spelllang& dictionary& ignorecase&
301endfunc
302
zeertzjq59f70382023-06-06 15:59:59 +0100303func Test_spellrepall()
Bram Moolenaar545cb792017-05-23 11:31:22 +0200304 new
305 set spell
306 call assert_fails('spellrepall', 'E752:')
307 call setline(1, ['A speling mistake. The same speling mistake.',
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200308 \ 'Another speling mistake.'])
Bram Moolenaar545cb792017-05-23 11:31:22 +0200309 call feedkeys(']s1z=', 'tx')
310 call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
311 call assert_equal('Another speling mistake.', getline(2))
312 spellrepall
313 call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
314 call assert_equal('Another spelling mistake.', getline(2))
315 call assert_fails('spellrepall', 'E753:')
316 set spell&
317 bwipe!
318endfunc
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200319
Bram Moolenaar54e5fed2022-07-04 13:37:07 +0100320func Test_spell_dump_word_length()
321 " this was running over MAXWLEN
322 new
323 noremap 0 0a0zW0000000
324 sil! norm 0z=0
325 sil norm 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
326 sil! norm 0z=0
327
328 bwipe!
329 nunmap 0
330endfunc
331
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100332" Test spellsuggest({word} [, {max} [, {capital}]])
333func Test_spellsuggest()
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200334 " Verify suggestions are given even when spell checking is not enabled.
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100335 set nospell
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200336 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100337
338 set spell
339
340 " With 1 argument.
Bram Moolenaar76734052019-12-26 14:30:15 +0100341 call assert_equal(['march', 'March'], spellsuggest('marrch')[0:1])
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100342
343 " With 2 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100344 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100345
346 " With 3 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100347 call assert_equal(['march'], spellsuggest('marrch', 1, 0))
348 call assert_equal(['March'], spellsuggest('marrch', 1, 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100349
350 " Test with digits and hyphen.
351 call assert_equal('Carbon-14', spellsuggest('Carbon-15')[0])
352
353 " Comment taken from spellsuggest.c explains the following test cases:
354 "
355 " If there are more UPPER than lower case letters suggest an
356 " ALLCAP word. Otherwise, if the first letter is UPPER then
357 " suggest ONECAP. Exception: "ALl" most likely should be "All",
358 " require three upper case letters.
Bram Moolenaar76734052019-12-26 14:30:15 +0100359 call assert_equal(['THIRD', 'third'], spellsuggest('thIRD', 2))
360 call assert_equal(['third', 'THIRD'], spellsuggest('tHIrd', 2))
361 call assert_equal(['Third'], spellsuggest('THird', 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100362 call assert_equal(['All'], spellsuggest('ALl', 1))
363
Dominique Pellef645ee42021-12-05 13:21:18 +0000364 " Special suggestion for repeated 'the the'.
365 call assert_inrange(0, 2, index(spellsuggest('the the', 3), 'the'))
366 call assert_inrange(0, 2, index(spellsuggest('the the', 3), 'the'))
367 call assert_inrange(0, 2, index(spellsuggest('The the', 3), 'The'))
368
Bram Moolenaar0e05de42020-03-25 22:23:46 +0100369 call assert_fails("call spellsuggest('maxch', [])", 'E745:')
370 call assert_fails("call spellsuggest('maxch', 2, [])", 'E745:')
371
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200372 set spelllang=
373 call assert_fails("call spellsuggest('maxch')", 'E756:')
374 set spelllang&
375
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100376 set spell&
377endfunc
378
379" Test 'spellsuggest' option with methods fast, best and double.
380func Test_spellsuggest_option_methods()
381 set spell
382
Bram Moolenaar76734052019-12-26 14:30:15 +0100383 for e in ['latin1', 'utf-8']
384 exe 'set encoding=' .. e
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100385
Bram Moolenaar76734052019-12-26 14:30:15 +0100386 set spellsuggest=fast
387 call assert_equal(['Stick', 'Stitch'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100388
Bram Moolenaar76734052019-12-26 14:30:15 +0100389 " With best or double option, "Stitch" should become the top suggestion
390 " because of better phonetic matching.
391 set spellsuggest=best
392 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100393
Bram Moolenaar76734052019-12-26 14:30:15 +0100394 set spellsuggest=double
395 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
396 endfor
397
398 set spell& spellsuggest& encoding&
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100399endfunc
400
401" Test 'spellsuggest' option with value file:{filename}
402func Test_spellsuggest_option_file()
403 set spell spellsuggest=file:Xspellsuggest
404 call writefile(['emacs/vim',
405 \ 'theribal/terrible',
406 \ 'teribal/terrrible',
407 \ 'terribal'],
408 \ 'Xspellsuggest')
409
410 call assert_equal(['vim'], spellsuggest('emacs', 2))
411 call assert_equal(['terrible'], spellsuggest('theribal',2))
412
413 " If the suggestion is misspelled (*terrrible* with 3 r),
414 " it should not be proposed.
415 " The entry for "terribal" should be ignored because of missing slash.
416 call assert_equal([], spellsuggest('teribal', 2))
417 call assert_equal([], spellsuggest('terribal', 2))
418
419 set spell spellsuggest=best,file:Xspellsuggest
420 call assert_equal(['vim', 'Emacs'], spellsuggest('emacs', 2))
421 call assert_equal(['terrible', 'tribal'], spellsuggest('theribal', 2))
422 call assert_equal(['tribal'], spellsuggest('teribal', 1))
423 call assert_equal(['tribal'], spellsuggest('terribal', 1))
424
425 call delete('Xspellsuggest')
426 call assert_fails("call spellsuggest('vim')", "E484: Can't open file Xspellsuggest")
427
428 set spellsuggest& spell&
429endfunc
430
431" Test 'spellsuggest' option with value {number}
432" to limit the number of suggestions
433func Test_spellsuggest_option_number()
434 set spell spellsuggest=2,best
435 new
436
437 " We limited the number of suggestions to 2, so selecting
438 " the 1st and 2nd suggestion should correct the word, but
439 " selecting a 3rd suggestion should do nothing.
Bram Moolenaar76734052019-12-26 14:30:15 +0100440 call setline(1, 'A baord')
441 norm $1z=
442 call assert_equal('A board', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100443
Bram Moolenaar76734052019-12-26 14:30:15 +0100444 call setline(1, 'A baord')
445 norm $2z=
446 call assert_equal('A bard', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100447
Bram Moolenaar76734052019-12-26 14:30:15 +0100448 call setline(1, 'A baord')
449 norm $3z=
450 call assert_equal('A baord', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100451
Bram Moolenaar76734052019-12-26 14:30:15 +0100452 let a = execute('norm $z=')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100453 call assert_equal(
454 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100455 \ .. "Change \"baord\" to:\n"
456 \ .. " 1 \"board\"\n"
457 \ .. " 2 \"bard\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200458 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100459
460 set spell spellsuggest=0
Bram Moolenaar76734052019-12-26 14:30:15 +0100461 call assert_equal("\nSorry, no suggestions", execute('norm $z='))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100462
463 " Unlike z=, function spellsuggest(...) should not be affected by the
464 " max number of suggestions (2) set by the 'spellsuggest' option.
Bram Moolenaar76734052019-12-26 14:30:15 +0100465 call assert_equal(['board', 'bard', 'broad'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100466
467 set spellsuggest& spell&
468 bwipe!
469endfunc
470
471" Test 'spellsuggest' option with value expr:{expr}
472func Test_spellsuggest_option_expr()
473 " A silly 'spellsuggest' function which makes suggestions all uppercase
474 " and makes the score of each suggestion the length of the suggested word.
475 " So shorter suggestions are preferred.
476 func MySuggest()
477 let spellsuggest_save = &spellsuggest
Bram Moolenaar76734052019-12-26 14:30:15 +0100478 set spellsuggest=3,best
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100479 let result = map(spellsuggest(v:val, 3), "[toupper(v:val), len(v:val)]")
480 let &spellsuggest = spellsuggest_save
481 return result
482 endfunc
483
Bram Moolenaar76734052019-12-26 14:30:15 +0100484 set spell spellsuggest=expr:MySuggest()
485 call assert_equal(['BARD', 'BOARD', 'BROAD'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100486
487 new
Bram Moolenaar76734052019-12-26 14:30:15 +0100488 call setline(1, 'baord')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100489 let a = execute('norm z=')
490 call assert_equal(
491 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100492 \ .. "Change \"baord\" to:\n"
493 \ .. " 1 \"BARD\"\n"
494 \ .. " 2 \"BOARD\"\n"
495 \ .. " 3 \"BROAD\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200496 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100497
498 " With verbose, z= should show the score i.e. word length with
499 " our SpellSuggest() function.
500 set verbose=1
501 let a = execute('norm z=')
502 call assert_equal(
503 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100504 \ .. "Change \"baord\" to:\n"
505 \ .. " 1 \"BARD\" (4 - 0)\n"
506 \ .. " 2 \"BOARD\" (5 - 0)\n"
507 \ .. " 3 \"BROAD\" (5 - 0)\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200508 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100509
510 set spell& spellsuggest& verbose&
511 bwipe!
512endfunc
513
Dominique Pelle81b573d2022-03-22 21:14:55 +0000514" Test for 'spellsuggest' expr errors
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100515func Test_spellsuggest_expr_errors()
516 " 'spellsuggest'
517 func MySuggest()
518 return range(3)
519 endfunc
520 set spell spellsuggest=expr:MySuggest()
521 call assert_equal([], spellsuggest('baord', 3))
522
523 " Test for 'spellsuggest' expression returning a non-list value
524 func! MySuggest2()
525 return 'good'
526 endfunc
527 set spellsuggest=expr:MySuggest2()
528 call assert_equal([], spellsuggest('baord'))
529
530 " Test for 'spellsuggest' expression returning a list with dict values
531 func! MySuggest3()
532 return [[{}, {}]]
533 endfunc
534 set spellsuggest=expr:MySuggest3()
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200535 call assert_fails("call spellsuggest('baord')", 'E731:')
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100536
537 set nospell spellsuggest&
538 delfunc MySuggest
539 delfunc MySuggest2
540 delfunc MySuggest3
541endfunc
542
Bram Moolenaar585ee072022-01-29 11:22:17 +0000543func Test_spellsuggest_timeout()
544 set spellsuggest=timeout:30
545 set spellsuggest=timeout:-123
546 set spellsuggest=timeout:999999
547 call assert_fails('set spellsuggest=timeout', 'E474:')
548 call assert_fails('set spellsuggest=timeout:x', 'E474:')
549 call assert_fails('set spellsuggest=timeout:-x', 'E474:')
550 call assert_fails('set spellsuggest=timeout:--9', 'E474:')
551endfunc
552
Bram Moolenaar5c686172022-03-13 20:12:25 +0000553func Test_spellsuggest_visual_end_of_line()
554 let enc_save = &encoding
555 set encoding=iso8859
556
557 " This was reading beyond the end of the line.
558 norm R00000000000
559 sil norm 0
560 sil! norm i00000)
561 sil! norm i00000)
562 call feedkeys("\<CR>")
563 norm z=
564
565 let &encoding = enc_save
566endfunc
567
Bram Moolenaar9049b682018-08-31 22:26:53 +0200568func Test_spellinfo()
569 new
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200570 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
Bram Moolenaar9049b682018-08-31 22:26:53 +0200571
572 set enc=latin1 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200573 call assert_match("^\nfile: " .. runtime .. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200574
575 set enc=cp1250 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200576 call assert_match("^\nfile: " .. runtime .. "/spell/en.ascii.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200577
Bram Moolenaar30276f22019-01-24 17:59:39 +0100578 set enc=utf-8 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200579 call assert_match("^\nfile: " .. runtime .. "/spell/en.utf-8.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200580
581 set enc=latin1 spell spelllang=en_us,en_nz
582 call assert_match("^\n" .
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200583 \ "file: " .. runtime .. "/spell/en.latin1.spl\n" .
584 \ "file: " .. runtime.. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200585
586 set spell spelllang=
587 call assert_fails('spellinfo', 'E756:')
588
589 set nospell spelllang=en
590 call assert_fails('spellinfo', 'E756:')
591
Bram Moolenaar8f130ed2019-04-10 22:15:19 +0200592 call assert_fails('set spelllang=foo/bar', 'E474:')
593 call assert_fails('set spelllang=foo\ bar', 'E474:')
594 call assert_fails("set spelllang=foo\\\nbar", 'E474:')
595 call assert_fails("set spelllang=foo\\\rbar", 'E474:')
596 call assert_fails("set spelllang=foo+bar", 'E474:')
597
Bram Moolenaar9049b682018-08-31 22:26:53 +0200598 set enc& spell& spelllang&
599 bwipe
600endfunc
601
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200602func Test_zz_basic()
603 call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
604 call RunGoodBad("wrong OK puts. Test the end",
605 \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
606 \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
607 \ "test", "testen", "testn", "the end", "uk", "wrong"],
608 \[
609 \ ["bad", ["put", "uk", "OK"]],
610 \ ["inputs", ["input", "puts", "outputs"]],
611 \ ["comment", ["Comment", "outtest", "the end"]],
612 \ ["ok", ["OK", "uk", "put"]],
613 \ ["Ok", ["OK", "Uk", "Put"]],
614 \ ["test", ["Test", "testn", "testen"]],
615 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
616 \ ["end", ["put", "uk", "test"]],
617 \ ["the", ["put", "uk", "test"]],
618 \ ]
619 \ )
620
621 call assert_equal("gebletegek", soundfold('goobledygoook'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200622 call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200623 call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
624endfunc
625
626" Postponed prefixes
627func Test_zz_prefixes()
628 call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
629 call RunGoodBad("puts",
630 \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
631 \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
632 \ [
633 \ ["bad", ["put", "uk", "OK"]],
634 \ ["inputs", ["input", "puts", "outputs"]],
635 \ ["comment", ["Comment"]],
636 \ ["ok", ["OK", "uk", "put"]],
637 \ ["Ok", ["OK", "Uk", "Put"]],
638 \ ["end", ["put", "uk", "deol"]],
639 \ ["the", ["put", "uk", "test"]],
640 \ ["test", ["Test", "testn", "testen"]],
641 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
642 \ ])
643endfunc
644
645"Compound words
646func Test_zz_compound()
647 call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
648 call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
649 \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
650 \ ["foo", "m\xEF"],
651 \ [
652 \ ["bad", ["foo", "m\xEF"]],
653 \ ["bar", ["barfoo", "foobar", "foo"]],
654 \ ["la", ["m\xEF", "foo"]],
655 \ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
656 \ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
657 \ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
658 \ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
659 \ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
660 \ ["lala", []],
661 \ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
662 \ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
663 \ ["foola", ["foo", "foobar", "foofoo"]],
664 \ ["labar", ["barbar", "foobar"]],
665 \ ])
666
667 call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
668 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",
669 \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword",
670 \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
671 \ [
672 \ ["bad", ["end", "bork", "word"]],
673 \ ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
674 \ ["pro", ["bork", "word", "end"]],
675 \ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
676 \ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
677 \ ["endstart", ["end start", "start"]],
678 \ ["endend", ["end end", "end"]],
679 \ ["startstart", ["start start"]],
680 \ ["wordend", ["word end", "word", "wordword"]],
681 \ ["wordstart", ["word start", "bork start"]],
682 \ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
683 \ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
684 \ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
685 \ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
686 \ ["utilsbork", ["utilbork", "utils bork", "util bork"]],
687 \ ["startnouword", ["start nouword", "startword", "startborkword"]],
688 \ ])
689
690endfunc
691
692"Test affix flags with two characters
693func Test_zz_affix()
694 call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
695 call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend",
696 \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
697 \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
698 \ [
699 \ ["bad", ["bar", "end", "fooa1"]],
700 \ ["foo", ["fooa1", "fooa\xE9", "bar"]],
701 \ ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
702 \ ["prabar", ["prebar", "bar", "bar bar"]],
703 \ ["probarbirk", ["prebarbork"]],
704 \ ["middle", []],
705 \ ["startmiddle", ["startmiddleend", "startmiddlebar"]],
706 \ ["middleend", []],
707 \ ["endstart", ["end start", "start"]],
708 \ ["startprobar", ["startprebar", "start prebar", "startbar"]],
709 \ ["startnouend", ["start nouend", "startend"]],
710 \ ])
711
712 call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
713 call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend",
714 \ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
715 \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
716 \ [
717 \ ["bad", ["bar", "end", "lead"]],
718 \ ["mee", ["meea1", "meea\xE9", "bar"]],
719 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
720 \ ["prabar", ["prebar", "bar", "leadbar"]],
721 \ ["probarbirk", ["prebarbork"]],
722 \ ["middle", []],
723 \ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
724 \ ["middleend", []],
725 \ ["endlead", ["end lead", "lead", "end end"]],
726 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
727 \ ])
728
729 call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100730 call RunGoodBad("meea1 meezero meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200731 \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100732 \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "meezero", "prebar", "prebarmeat", "tail"],
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200733 \ [
734 \ ["bad", ["bar", "lead", "tail"]],
735 \ ["mee", ["meea1", "meea\xE9", "bar"]],
736 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
737 \ ["prabar", ["prebar", "bar", "leadbar"]],
738 \ ["probarmaat", ["prebarmeat"]],
739 \ ["middle", []],
740 \ ["leadmiddle", ["leadmiddlebar"]],
741 \ ["middletail", []],
742 \ ["taillead", ["tail lead", "tail"]],
743 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
744 \ ])
745endfunc
746
747func Test_zz_NOSLITSUGS()
748 call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
749 call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
750 \ ["bar", "faabar", "foo"],
751 \ [
752 \ ["bad", ["bar", "foo"]],
753 \ ["foobar", ["faabar", "foo bar", "bar"]],
754 \ ["barfoo", ["bar foo", "bar", "foo"]],
755 \ ])
756endfunc
757
758" Numbers
759func Test_zz_Numbers()
760 call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
761 call RunGoodBad("0b1011 0777 1234 0x01ff", "",
762 \ ["bar", "foo"],
763 \ [
764 \ ])
765endfunc
766
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +0100767" Affix flags
768func Test_zz_affix_flags()
769 call LoadAffAndDic(g:test_data_aff10, g:test_data_dic10)
770 call RunGoodBad("drink drinkable drinkables drinktable drinkabletable",
771 \ "bad: drinks drinkstable drinkablestable",
772 \ ["drink", "drinkable", "drinkables", "table"],
773 \ [['bad', []],
774 \ ['drinks', ['drink']],
775 \ ['drinkstable', ['drinktable', 'drinkable', 'drink table']],
776 \ ['drinkablestable', ['drinkabletable', 'drinkables table', 'drinkable table']],
777 \ ])
778endfunc
779
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200780function FirstSpellWord()
781 call feedkeys("/^start:\n", 'tx')
782 normal ]smm
783 let [str, a] = spellbadword()
784 return str
785endfunc
786
787function SecondSpellWord()
788 normal `m]s
789 let [str, a] = spellbadword()
790 return str
791endfunc
792
793"Test with SAL instead of SOFO items; test automatic reloading
794func Test_zz_sal_and_addition()
795 set enc=latin1
796 set spellfile=
Bram Moolenaar56564962022-10-10 22:39:42 +0100797 call writefile(g:test_data_dic1, "Xtest.dic", 'D')
798 call writefile(g:test_data_aff_sal, "Xtest.aff", 'D')
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200799 mkspell! Xtest Xtest
800 set spl=Xtest.latin1.spl spell
801 call assert_equal('kbltykk', soundfold('goobledygoook'))
802 call assert_equal('kprnfn', soundfold('kóopërÿnôven'))
803 call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
804
805 "also use an addition file
Bram Moolenaar56564962022-10-10 22:39:42 +0100806 call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add", 'D')
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200807 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
808
809 bwipe!
810 call setline(1, ["start: elequint test elekwint test elekwent asdf"])
811
812 set spellfile=Xtest.latin1.add
813 call assert_equal("elekwent", FirstSpellWord())
814
815 set spl=Xtest_us.latin1.spl
816 call assert_equal("elequint", FirstSpellWord())
817 call assert_equal("elekwint", SecondSpellWord())
818
819 set spl=Xtest_gb.latin1.spl
820 call assert_equal("elekwint", FirstSpellWord())
821 call assert_equal("elekwent", SecondSpellWord())
822
823 set spl=Xtest_nz.latin1.spl
824 call assert_equal("elequint", FirstSpellWord())
825 call assert_equal("elekwent", SecondSpellWord())
826
827 set spl=Xtest_ca.latin1.spl
828 call assert_equal("elequint", FirstSpellWord())
829 call assert_equal("elekwint", SecondSpellWord())
zeertzjq288ed232022-07-04 11:03:07 +0100830
831 bwipe!
832 set spellfile=
833 set spl&
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200834endfunc
835
Bram Moolenaar862f1e12019-04-10 22:33:41 +0200836func Test_spellfile_value()
837 set spellfile=Xdir/Xtest.latin1.add
838 set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
839endfunc
840
Bram Moolenaaree03b942017-10-27 00:57:05 +0200841func Test_region_error()
842 messages clear
Bram Moolenaar56564962022-10-10 22:39:42 +0100843 call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add", 'D')
Bram Moolenaaree03b942017-10-27 00:57:05 +0200844 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
845 call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
Bram Moolenaaree03b942017-10-27 00:57:05 +0200846 call delete('Xtest.latin1.add.spl')
847endfunc
848
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200849" Check using z= in new buffer (crash fixed by patch 7.4a.028).
850func Test_zeq_crash()
851 new
852 set maxmem=512 spell
853 call feedkeys('iasdz=:\"', 'tx')
854
855 bwipe!
856endfunc
857
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200858" Check that z= works even when 'nospell' is set. This test uses one of the
859" tests in Test_spellsuggest_option_number() just to verify that z= basically
860" works and that "E756: Spell checking is not enabled" is not generated.
861func Test_zeq_nospell()
862 new
863 set nospell spellsuggest=1,best
864 call setline(1, 'A baord')
865 try
866 norm $1z=
867 call assert_equal('A board', getline(1))
868 catch
869 call assert_report("Caught exception: " . v:exception)
870 endtry
871 set spell& spellsuggest&
872 bwipe!
873endfunc
874
875" Check that "E756: Spell checking is not possible" is reported when z= is
876" executed and 'spelllang' is empty.
877func Test_zeq_no_spelllang()
878 new
879 set spelllang= spellsuggest=1,best
880 call setline(1, 'A baord')
881 call assert_fails('normal $1z=', 'E756:')
882 set spelllang& spellsuggest&
883 bwipe!
884endfunc
885
Bram Moolenaar5bcc5a12019-08-06 22:48:02 +0200886" Check handling a word longer than MAXWLEN.
887func Test_spell_long_word()
888 set enc=utf-8
889 new
890 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")
891 set spell spelllang=en
892 redraw
893 redraw!
894 bwipe!
895 set nospell
896endfunc
897
Bram Moolenaar06f15412022-01-29 10:51:59 +0000898func Test_spellsuggest_too_deep()
899 " This was incrementing "depth" over MAXWLEN.
900 new
901 norm s000G00ý000000000000
902 sil norm ..vzG................vvzG0 v z=
903 bwipe!
904endfunc
905
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100906func Test_spell_good_word_invalid()
907 " This was adding a word with a 0x02 byte, which causes havoc.
908 enew
909 norm o0
910 sil! norm rzzWs00/
911 2
912 sil! norm VzGprzzW
913 sil! norm z=
914
915 bwipe!
Bram Moolenaar5e59ea52022-07-01 22:26:20 +0100916endfunc
917
K.Takata2ebcc352022-07-14 17:25:14 +0100918func Test_spell_good_word_slash()
919 " This caused E1280.
920 new
921 norm afoo /
922 1
923 norm zG
924
925 bwipe!
926endfunc
927
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200928func LoadAffAndDic(aff_contents, dic_contents)
929 set enc=latin1
930 set spellfile=
931 call writefile(a:aff_contents, "Xtest.aff")
932 call writefile(a:dic_contents, "Xtest.dic")
933 " Generate a .spl file from a .dic and .aff file.
934 mkspell! Xtest Xtest
935 " use that spell file
936 set spl=Xtest.latin1.spl spell
937endfunc
938
939func ListWords()
940 spelldump
941 %yank
942 quit
943 return split(@", "\n")
944endfunc
945
946func TestGoodBadBase()
947 exe '1;/^good:'
948 normal 0f:]s
949 let prevbad = ''
950 let result = []
951 while 1
952 let [bad, a] = spellbadword()
953 if bad == '' || bad == prevbad || bad == 'badend'
954 break
955 endif
956 let prevbad = bad
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200957 let lst = bad->spellsuggest(3)
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200958 normal mm
959
960 call add(result, [bad, lst])
961 normal `m]s
962 endwhile
963 return result
964endfunc
965
966func RunGoodBad(good, bad, expected_words, expected_bad_words)
967 bwipe!
968 call setline(1, ["good: ", a:good, a:bad, " badend "])
969 let words = ListWords()
970 call assert_equal(a:expected_words, words[1:-1])
971 let bad_words = TestGoodBadBase()
972 call assert_equal(a:expected_bad_words, bad_words)
973 bwipe!
974endfunc
975
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200976func Test_spell_screendump()
977 CheckScreendump
978
979 let lines =<< trim END
Luuk van Baale84c7732023-05-31 18:57:36 +0100980 call test_override('alloc_lines', 1)
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200981 call setline(1, [
982 \ "This is some text without any spell errors. Everything",
983 \ "should just be black, nothing wrong here.",
984 \ "",
985 \ "This line has a sepll error. and missing caps.",
986 \ "And and this is the the duplication.",
987 \ "with missing caps here.",
988 \ ])
989 set spell spelllang=en_nz
990 END
Bram Moolenaarf3ef0262022-10-05 13:29:15 +0100991 call writefile(lines, 'XtestSpell', 'D')
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200992 let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
993 call VerifyScreenDump(buf, 'Test_spell_1', {})
994
995 " clean up
996 call StopVimInTerminal(buf)
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200997endfunc
998
Christian Brabandtafa23d12022-08-09 12:25:10 +0100999func Test_spell_screendump_spellcap()
1000 CheckScreendump
1001
1002 let lines =<< trim END
Luuk van Baale84c7732023-05-31 18:57:36 +01001003 call test_override('alloc_lines', 1)
Christian Brabandtafa23d12022-08-09 12:25:10 +01001004 call setline(1, [
1005 \ " This line has a sepll error. and missing caps and trailing spaces. ",
1006 \ "another missing cap here.",
1007 \ "",
1008 \ "and here.",
1009 \ " ",
1010 \ "and here."
1011 \ ])
1012 set spell spelllang=en
1013 END
Bram Moolenaarf3ef0262022-10-05 13:29:15 +01001014 call writefile(lines, 'XtestSpellCap', 'D')
Christian Brabandtafa23d12022-08-09 12:25:10 +01001015 let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8})
1016 call VerifyScreenDump(buf, 'Test_spell_2', {})
1017
Bram Moolenaaree09fcc2022-09-25 20:58:30 +01001018 " After adding word missing Cap in next line is updated
1019 call term_sendkeys(buf, "3GANot\<Esc>")
1020 call VerifyScreenDump(buf, 'Test_spell_3', {})
1021
Bram Moolenaar26f09ea2022-09-27 16:29:38 +01001022 " Deleting a full stop removes missing Cap in next line
Luuk van Baal2ac64972023-05-25 17:14:42 +01001023 call term_sendkeys(buf, "5Gdd\<C-L>k$x")
Bram Moolenaar26f09ea2022-09-27 16:29:38 +01001024 call VerifyScreenDump(buf, 'Test_spell_4', {})
1025
1026 " Undo also updates the next line (go to command line to remove message)
1027 call term_sendkeys(buf, "u:\<Esc>")
1028 call VerifyScreenDump(buf, 'Test_spell_5', {})
1029
Luuk van Baal2ac64972023-05-25 17:14:42 +01001030 " Folding an empty line does not remove Cap in next line
1031 call term_sendkeys(buf, "uzfk:\<Esc>")
1032 call VerifyScreenDump(buf, 'Test_spell_6', {})
1033
1034 " Folding the end of a sentence does not remove Cap in next line
1035 " and editing a line does not remove Cap in current line
1036 call term_sendkeys(buf, "Jzfkk$x")
1037 call VerifyScreenDump(buf, 'Test_spell_7', {})
1038
1039 " Cap is correctly applied in the first row of a window
1040 call term_sendkeys(buf, "\<C-E>\<C-L>")
1041 call VerifyScreenDump(buf, 'Test_spell_8', {})
1042
Luuk van Baale84c7732023-05-31 18:57:36 +01001043 " Adding an empty line does not remove Cap in "mod_bot" area
1044 call term_sendkeys(buf, "zbO\<Esc>")
1045 call VerifyScreenDump(buf, 'Test_spell_9', {})
1046
1047 " Multiple empty lines does not remove Cap in the line after
1048 call term_sendkeys(buf, "O\<Esc>\<C-L>")
1049 call VerifyScreenDump(buf, 'Test_spell_10', {})
1050
Christian Brabandtafa23d12022-08-09 12:25:10 +01001051 " clean up
1052 call StopVimInTerminal(buf)
Bram Moolenaarf3ef0262022-10-05 13:29:15 +01001053endfunc
1054
1055func Test_spell_compatible()
1056 CheckScreendump
1057
1058 let lines =<< trim END
Luuk van Baale84c7732023-05-31 18:57:36 +01001059 call test_override('alloc_lines', 1)
Bram Moolenaarf3ef0262022-10-05 13:29:15 +01001060 call setline(1, [
1061 \ "test "->repeat(20),
1062 \ "",
1063 \ "end",
1064 \ ])
1065 set spell cpo+=$
1066 END
1067 call writefile(lines, 'XtestSpellComp', 'D')
1068 let buf = RunVimInTerminal('-S XtestSpellComp', {'rows': 8})
1069
1070 call term_sendkeys(buf, "51|C")
1071 call VerifyScreenDump(buf, 'Test_spell_compatible_1', {})
1072
1073 call term_sendkeys(buf, "x")
1074 call VerifyScreenDump(buf, 'Test_spell_compatible_2', {})
1075
1076 " clean up
1077 call StopVimInTerminal(buf)
Christian Brabandtafa23d12022-08-09 12:25:10 +01001078endfunc
1079
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001080let g:test_data_aff1 = [
1081 \"SET ISO8859-1",
1082 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1083 \"",
1084 \"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",
1085 \"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",
1086 \"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",
1087 \"",
1088 \"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",
1089 \"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
1090 \"",
1091 \"MIDWORD\t'-",
1092 \"",
1093 \"KEP =",
1094 \"RAR ?",
1095 \"BAD !",
1096 \"",
1097 \"PFX I N 1",
1098 \"PFX I 0 in .",
1099 \"",
1100 \"PFX O Y 1",
1101 \"PFX O 0 out .",
1102 \"",
1103 \"SFX S Y 2",
1104 \"SFX S 0 s [^s]",
1105 \"SFX S 0 es s",
1106 \"",
1107 \"SFX N N 3",
1108 \"SFX N 0 en [^n]",
1109 \"SFX N 0 nen n",
1110 \"SFX N 0 n .",
1111 \"",
1112 \"REP 3",
1113 \"REP g ch",
1114 \"REP ch g",
1115 \"REP svp s.v.p.",
1116 \"",
1117 \"MAP 9",
1118 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1119 \"MAP e\xE8\xE9\xEA\xEB",
1120 \"MAP i\xEC\xED\xEE\xEF",
1121 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1122 \"MAP u\xF9\xFA\xFB\xFC",
1123 \"MAP n\xF1",
1124 \"MAP c\xE7",
1125 \"MAP y\xFF\xFD",
1126 \"MAP s\xDF",
1127 \ ]
1128let g:test_data_dic1 = [
1129 \"123456",
1130 \"test/NO",
1131 \"# comment",
1132 \"wrong",
1133 \"Comment",
1134 \"OK",
1135 \"uk",
1136 \"put/ISO",
1137 \"the end",
1138 \"deol",
1139 \"d\xE9\xF4r",
1140 \ ]
1141let g:test_data_aff2 = [
1142 \"SET ISO8859-1",
1143 \"",
1144 \"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",
1145 \"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",
1146 \"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",
1147 \"",
1148 \"PFXPOSTPONE",
1149 \"",
1150 \"MIDWORD\t'-",
1151 \"",
1152 \"KEP =",
1153 \"RAR ?",
1154 \"BAD !",
1155 \"",
1156 \"PFX I N 1",
1157 \"PFX I 0 in .",
1158 \"",
1159 \"PFX O Y 1",
1160 \"PFX O 0 out [a-z]",
1161 \"",
1162 \"SFX S Y 2",
1163 \"SFX S 0 s [^s]",
1164 \"SFX S 0 es s",
1165 \"",
1166 \"SFX N N 3",
1167 \"SFX N 0 en [^n]",
1168 \"SFX N 0 nen n",
1169 \"SFX N 0 n .",
1170 \"",
1171 \"REP 3",
1172 \"REP g ch",
1173 \"REP ch g",
1174 \"REP svp s.v.p.",
1175 \"",
1176 \"MAP 9",
1177 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1178 \"MAP e\xE8\xE9\xEA\xEB",
1179 \"MAP i\xEC\xED\xEE\xEF",
1180 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1181 \"MAP u\xF9\xFA\xFB\xFC",
1182 \"MAP n\xF1",
1183 \"MAP c\xE7",
1184 \"MAP y\xFF\xFD",
1185 \"MAP s\xDF",
1186 \ ]
1187let g:test_data_aff3 = [
1188 \"SET ISO8859-1",
1189 \"",
1190 \"COMPOUNDMIN 3",
1191 \"COMPOUNDRULE m*",
1192 \"NEEDCOMPOUND x",
1193 \ ]
1194let g:test_data_dic3 = [
1195 \"1234",
1196 \"foo/m",
1197 \"bar/mx",
1198 \"m\xEF/m",
1199 \"la/mx",
1200 \ ]
1201let g:test_data_aff4 = [
1202 \"SET ISO8859-1",
1203 \"",
1204 \"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",
1205 \"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",
1206 \"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",
1207 \"",
1208 \"COMPOUNDRULE m+",
1209 \"COMPOUNDRULE sm*e",
1210 \"COMPOUNDRULE sm+",
1211 \"COMPOUNDMIN 3",
1212 \"COMPOUNDWORDMAX 3",
1213 \"COMPOUNDFORBIDFLAG t",
1214 \"",
1215 \"COMPOUNDSYLMAX 5",
1216 \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
1217 \"",
1218 \"MAP 9",
1219 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1220 \"MAP e\xE8\xE9\xEA\xEB",
1221 \"MAP i\xEC\xED\xEE\xEF",
1222 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1223 \"MAP u\xF9\xFA\xFB\xFC",
1224 \"MAP n\xF1",
1225 \"MAP c\xE7",
1226 \"MAP y\xFF\xFD",
1227 \"MAP s\xDF",
1228 \"",
1229 \"NEEDAFFIX x",
1230 \"",
1231 \"PFXPOSTPONE",
1232 \"",
1233 \"MIDWORD '-",
1234 \"",
1235 \"SFX q N 1",
1236 \"SFX q 0 -ok .",
1237 \"",
1238 \"SFX a Y 2",
1239 \"SFX a 0 s .",
1240 \"SFX a 0 ize/t .",
1241 \"",
1242 \"PFX p N 1",
1243 \"PFX p 0 pre .",
1244 \"",
1245 \"PFX P N 1",
1246 \"PFX P 0 nou .",
1247 \ ]
1248let g:test_data_dic4 = [
1249 \"1234",
1250 \"word/mP",
1251 \"util/am",
1252 \"pro/xq",
1253 \"tomato/m",
1254 \"bork/mp",
1255 \"start/s",
1256 \"end/e",
1257 \ ]
1258let g:test_data_aff5 = [
1259 \"SET ISO8859-1",
1260 \"",
1261 \"FLAG long",
1262 \"",
1263 \"NEEDAFFIX !!",
1264 \"",
1265 \"COMPOUNDRULE ssmm*ee",
1266 \"",
1267 \"NEEDCOMPOUND xx",
1268 \"COMPOUNDPERMITFLAG pp",
1269 \"",
1270 \"SFX 13 Y 1",
1271 \"SFX 13 0 bork .",
1272 \"",
1273 \"SFX a1 Y 1",
1274 \"SFX a1 0 a1 .",
1275 \"",
1276 \"SFX a\xE9 Y 1",
1277 \"SFX a\xE9 0 a\xE9 .",
1278 \"",
1279 \"PFX zz Y 1",
1280 \"PFX zz 0 pre/pp .",
1281 \"",
1282 \"PFX yy Y 1",
1283 \"PFX yy 0 nou .",
1284 \ ]
1285let g:test_data_dic5 = [
1286 \"1234",
1287 \"foo/a1a\xE9!!",
1288 \"bar/zz13ee",
1289 \"start/ss",
1290 \"end/eeyy",
1291 \"middle/mmxx",
1292 \ ]
1293let g:test_data_aff6 = [
1294 \"SET ISO8859-1",
1295 \"",
1296 \"FLAG caplong",
1297 \"",
1298 \"NEEDAFFIX A!",
1299 \"",
1300 \"COMPOUNDRULE sMm*Ee",
1301 \"",
1302 \"NEEDCOMPOUND Xx",
1303 \"",
1304 \"COMPOUNDPERMITFLAG p",
1305 \"",
1306 \"SFX N3 Y 1",
1307 \"SFX N3 0 bork .",
1308 \"",
1309 \"SFX A1 Y 1",
1310 \"SFX A1 0 a1 .",
1311 \"",
1312 \"SFX A\xE9 Y 1",
1313 \"SFX A\xE9 0 a\xE9 .",
1314 \"",
1315 \"PFX Zz Y 1",
1316 \"PFX Zz 0 pre/p .",
1317 \ ]
1318let g:test_data_dic6 = [
1319 \"1234",
1320 \"mee/A1A\xE9A!",
1321 \"bar/ZzN3Ee",
1322 \"lead/s",
1323 \"end/Ee",
1324 \"middle/MmXx",
1325 \ ]
1326let g:test_data_aff7 = [
1327 \"SET ISO8859-1",
1328 \"",
1329 \"FLAG num",
1330 \"",
1331 \"NEEDAFFIX 9999",
1332 \"",
1333 \"COMPOUNDRULE 2,77*123",
1334 \"",
1335 \"NEEDCOMPOUND 1",
1336 \"COMPOUNDPERMITFLAG 432",
1337 \"",
1338 \"SFX 61003 Y 1",
1339 \"SFX 61003 0 meat .",
1340 \"",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001341 \"SFX 0 Y 1",
1342 \"SFX 0 0 zero .",
1343 \"",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001344 \"SFX 391 Y 1",
1345 \"SFX 391 0 a1 .",
1346 \"",
1347 \"SFX 111 Y 1",
1348 \"SFX 111 0 a\xE9 .",
1349 \"",
1350 \"PFX 17 Y 1",
1351 \"PFX 17 0 pre/432 .",
1352 \ ]
1353let g:test_data_dic7 = [
1354 \"1234",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001355 \"mee/0,391,111,9999",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001356 \"bar/17,61003,123",
1357 \"lead/2",
1358 \"tail/123",
1359 \"middle/77,1",
1360 \ ]
1361let g:test_data_aff8 = [
1362 \"SET ISO8859-1",
1363 \"",
1364 \"NOSPLITSUGS",
1365 \ ]
1366let g:test_data_dic8 = [
1367 \"1234",
1368 \"foo",
1369 \"bar",
1370 \"faabar",
1371 \ ]
1372let g:test_data_aff9 = [
1373 \ ]
1374let g:test_data_dic9 = [
1375 \"1234",
1376 \"foo",
1377 \"bar",
1378 \ ]
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +01001379let g:test_data_aff10 = [
1380 \"COMPOUNDRULE se",
1381 \"COMPOUNDPERMITFLAG p",
1382 \"",
1383 \"SFX A Y 1",
1384 \"SFX A 0 able/Mp .",
1385 \"",
1386 \"SFX M Y 1",
1387 \"SFX M 0 s .",
1388 \ ]
1389let g:test_data_dic10 = [
1390 \"1234",
1391 \"drink/As",
1392 \"table/e",
1393 \ ]
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001394let g:test_data_aff_sal = [
1395 \"SET ISO8859-1",
1396 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1397 \"",
1398 \"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",
1399 \"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",
1400 \"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",
1401 \"",
1402 \"MIDWORD\t'-",
1403 \"",
1404 \"KEP =",
1405 \"RAR ?",
1406 \"BAD !",
1407 \"",
1408 \"PFX I N 1",
1409 \"PFX I 0 in .",
1410 \"",
1411 \"PFX O Y 1",
1412 \"PFX O 0 out .",
1413 \"",
1414 \"SFX S Y 2",
1415 \"SFX S 0 s [^s]",
1416 \"SFX S 0 es s",
1417 \"",
1418 \"SFX N N 3",
1419 \"SFX N 0 en [^n]",
1420 \"SFX N 0 nen n",
1421 \"SFX N 0 n .",
1422 \"",
1423 \"REP 3",
1424 \"REP g ch",
1425 \"REP ch g",
1426 \"REP svp s.v.p.",
1427 \"",
1428 \"MAP 9",
1429 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1430 \"MAP e\xE8\xE9\xEA\xEB",
1431 \"MAP i\xEC\xED\xEE\xEF",
1432 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1433 \"MAP u\xF9\xFA\xFB\xFC",
1434 \"MAP n\xF1",
1435 \"MAP c\xE7",
1436 \"MAP y\xFF\xFD",
1437 \"MAP s\xDF",
1438 \"",
1439 \"SAL AH(AEIOUY)-^ *H",
1440 \"SAL AR(AEIOUY)-^ *R",
1441 \"SAL A(HR)^ *",
1442 \"SAL A^ *",
1443 \"SAL AH(AEIOUY)- H",
1444 \"SAL AR(AEIOUY)- R",
1445 \"SAL A(HR) _",
1446 \"SAL \xC0^ *",
1447 \"SAL \xC5^ *",
1448 \"SAL BB- _",
1449 \"SAL B B",
1450 \"SAL CQ- _",
1451 \"SAL CIA X",
1452 \"SAL CH X",
1453 \"SAL C(EIY)- S",
1454 \"SAL CK K",
1455 \"SAL COUGH^ KF",
1456 \"SAL CC< C",
1457 \"SAL C K",
1458 \"SAL DG(EIY) K",
1459 \"SAL DD- _",
1460 \"SAL D T",
1461 \"SAL \xC9< E",
1462 \"SAL EH(AEIOUY)-^ *H",
1463 \"SAL ER(AEIOUY)-^ *R",
1464 \"SAL E(HR)^ *",
1465 \"SAL ENOUGH^$ *NF",
1466 \"SAL E^ *",
1467 \"SAL EH(AEIOUY)- H",
1468 \"SAL ER(AEIOUY)- R",
1469 \"SAL E(HR) _",
1470 \"SAL FF- _",
1471 \"SAL F F",
1472 \"SAL GN^ N",
1473 \"SAL GN$ N",
1474 \"SAL GNS$ NS",
1475 \"SAL GNED$ N",
1476 \"SAL GH(AEIOUY)- K",
1477 \"SAL GH _",
1478 \"SAL GG9 K",
1479 \"SAL G K",
1480 \"SAL H H",
1481 \"SAL IH(AEIOUY)-^ *H",
1482 \"SAL IR(AEIOUY)-^ *R",
1483 \"SAL I(HR)^ *",
1484 \"SAL I^ *",
1485 \"SAL ING6 N",
1486 \"SAL IH(AEIOUY)- H",
1487 \"SAL IR(AEIOUY)- R",
1488 \"SAL I(HR) _",
1489 \"SAL J K",
1490 \"SAL KN^ N",
1491 \"SAL KK- _",
1492 \"SAL K K",
1493 \"SAL LAUGH^ LF",
1494 \"SAL LL- _",
1495 \"SAL L L",
1496 \"SAL MB$ M",
1497 \"SAL MM M",
1498 \"SAL M M",
1499 \"SAL NN- _",
1500 \"SAL N N",
1501 \"SAL OH(AEIOUY)-^ *H",
1502 \"SAL OR(AEIOUY)-^ *R",
1503 \"SAL O(HR)^ *",
1504 \"SAL O^ *",
1505 \"SAL OH(AEIOUY)- H",
1506 \"SAL OR(AEIOUY)- R",
1507 \"SAL O(HR) _",
1508 \"SAL PH F",
1509 \"SAL PN^ N",
1510 \"SAL PP- _",
1511 \"SAL P P",
1512 \"SAL Q K",
1513 \"SAL RH^ R",
1514 \"SAL ROUGH^ RF",
1515 \"SAL RR- _",
1516 \"SAL R R",
1517 \"SAL SCH(EOU)- SK",
1518 \"SAL SC(IEY)- S",
1519 \"SAL SH X",
1520 \"SAL SI(AO)- X",
1521 \"SAL SS- _",
1522 \"SAL S S",
1523 \"SAL TI(AO)- X",
1524 \"SAL TH @",
1525 \"SAL TCH-- _",
1526 \"SAL TOUGH^ TF",
1527 \"SAL TT- _",
1528 \"SAL T T",
1529 \"SAL UH(AEIOUY)-^ *H",
1530 \"SAL UR(AEIOUY)-^ *R",
1531 \"SAL U(HR)^ *",
1532 \"SAL U^ *",
1533 \"SAL UH(AEIOUY)- H",
1534 \"SAL UR(AEIOUY)- R",
1535 \"SAL U(HR) _",
1536 \"SAL V^ W",
1537 \"SAL V F",
1538 \"SAL WR^ R",
1539 \"SAL WH^ W",
1540 \"SAL W(AEIOU)- W",
1541 \"SAL X^ S",
1542 \"SAL X KS",
1543 \"SAL Y(AEIOU)- Y",
1544 \"SAL ZZ- _",
1545 \"SAL Z S",
1546 \ ]
Bram Moolenaar0e05de42020-03-25 22:23:46 +01001547
1548" vim: shiftwidth=2 sts=2 expandtab