blob: aee51c7785d664b38b281581b2021e931fc469ad [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')
17endfunc
18
Bram Moolenaard3f78dc2017-02-25 14:21:10 +010019func Test_wrap_search()
20 new
21 call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End'])
22 set spell wrapscan
23 normal ]s
24 call assert_equal('plong', expand('<cword>'))
25 normal ]s
26 call assert_equal('zpelling', expand('<cword>'))
27 normal ]s
28 call assert_equal('plong', expand('<cword>'))
29 bwipe!
30 set nospell
31endfunc
Bram Moolenaar5b276aa2017-04-22 23:49:52 +020032
Bram Moolenaarb73fa622017-12-21 20:27:47 +010033func Test_curswant()
34 new
35 call setline(1, ['Another plong line', 'abcdefghijklmnopq'])
36 set spell wrapscan
37 normal 0]s
38 call assert_equal('plong', expand('<cword>'))
39 normal j
40 call assert_equal(9, getcurpos()[2])
41 normal 0[s
42 call assert_equal('plong', expand('<cword>'))
43 normal j
44 call assert_equal(9, getcurpos()[2])
45
46 normal 0]S
47 call assert_equal('plong', expand('<cword>'))
48 normal j
49 call assert_equal(9, getcurpos()[2])
50 normal 0[S
51 call assert_equal('plong', expand('<cword>'))
52 normal j
53 call assert_equal(9, getcurpos()[2])
54
55 normal 1G0
56 call assert_equal('plong', spellbadword()[0])
57 normal j
58 call assert_equal(9, getcurpos()[2])
59
60 bwipe!
61 set nospell
62endfunc
63
Bram Moolenaar5b276aa2017-04-22 23:49:52 +020064func Test_z_equal_on_invalid_utf8_word()
65 split
66 set spell
67 call setline(1, "\xff")
68 norm z=
69 set nospell
70 bwipe!
71endfunc
Bram Moolenaar545cb792017-05-23 11:31:22 +020072
Bram Moolenaar872e4512018-07-20 23:36:26 +020073" Test spellbadword() with argument
74func Test_spellbadword()
75 set spell
76
77 call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +020078 call assert_equal(['another', 'caps'], 'A sentence. another sentence'->spellbadword())
Bram Moolenaar872e4512018-07-20 23:36:26 +020079
80 set spelllang=en
81 call assert_equal(['', ''], spellbadword('centre'))
82 call assert_equal(['', ''], spellbadword('center'))
83 set spelllang=en_us
84 call assert_equal(['centre', 'local'], spellbadword('centre'))
85 call assert_equal(['', ''], spellbadword('center'))
86 set spelllang=en_gb
87 call assert_equal(['', ''], spellbadword('centre'))
88 call assert_equal(['center', 'local'], spellbadword('center'))
89
90 " Create a small word list to test that spellbadword('...')
91 " can return ['...', 'rare'].
92 e Xwords
93 insert
94foo
95foobar/?
96.
97 w!
98 mkspell! Xwords.spl Xwords
99 set spelllang=Xwords.spl
100 call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
101
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200102 " Typo should be detected even without the 'spell' option.
Bram Moolenaar872e4512018-07-20 23:36:26 +0200103 set spelllang=en_gb nospell
104 call assert_equal(['', ''], spellbadword('centre'))
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200105 call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
106 call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))
107
108 set spelllang=
109 call assert_fails("call spellbadword('maxch')", 'E756:')
Bram Moolenaar872e4512018-07-20 23:36:26 +0200110
111 call delete('Xwords.spl')
112 call delete('Xwords')
113 set spelllang&
114 set spell&
115endfunc
116
Bram Moolenaar545cb792017-05-23 11:31:22 +0200117func Test_spellreall()
118 new
119 set spell
120 call assert_fails('spellrepall', 'E752:')
121 call setline(1, ['A speling mistake. The same speling mistake.',
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200122 \ 'Another speling mistake.'])
Bram Moolenaar545cb792017-05-23 11:31:22 +0200123 call feedkeys(']s1z=', 'tx')
124 call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
125 call assert_equal('Another speling mistake.', getline(2))
126 spellrepall
127 call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
128 call assert_equal('Another spelling mistake.', getline(2))
129 call assert_fails('spellrepall', 'E753:')
130 set spell&
131 bwipe!
132endfunc
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200133
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100134" Test spellsuggest({word} [, {max} [, {capital}]])
135func Test_spellsuggest()
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200136 " Verify suggestions are given even when spell checking is not enabled.
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100137 set nospell
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200138 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100139
140 set spell
141
142 " With 1 argument.
Bram Moolenaar76734052019-12-26 14:30:15 +0100143 call assert_equal(['march', 'March'], spellsuggest('marrch')[0:1])
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100144
145 " With 2 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100146 call assert_equal(['march', 'March'], spellsuggest('marrch', 2))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100147
148 " With 3 arguments.
Bram Moolenaar76734052019-12-26 14:30:15 +0100149 call assert_equal(['march'], spellsuggest('marrch', 1, 0))
150 call assert_equal(['March'], spellsuggest('marrch', 1, 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100151
152 " Test with digits and hyphen.
153 call assert_equal('Carbon-14', spellsuggest('Carbon-15')[0])
154
155 " Comment taken from spellsuggest.c explains the following test cases:
156 "
157 " If there are more UPPER than lower case letters suggest an
158 " ALLCAP word. Otherwise, if the first letter is UPPER then
159 " suggest ONECAP. Exception: "ALl" most likely should be "All",
160 " require three upper case letters.
Bram Moolenaar76734052019-12-26 14:30:15 +0100161 call assert_equal(['THIRD', 'third'], spellsuggest('thIRD', 2))
162 call assert_equal(['third', 'THIRD'], spellsuggest('tHIrd', 2))
163 call assert_equal(['Third'], spellsuggest('THird', 1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100164 call assert_equal(['All'], spellsuggest('ALl', 1))
165
Bram Moolenaar0e05de42020-03-25 22:23:46 +0100166 call assert_fails("call spellsuggest('maxch', [])", 'E745:')
167 call assert_fails("call spellsuggest('maxch', 2, [])", 'E745:')
168
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200169 set spelllang=
170 call assert_fails("call spellsuggest('maxch')", 'E756:')
171 set spelllang&
172
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100173 set spell&
174endfunc
175
176" Test 'spellsuggest' option with methods fast, best and double.
177func Test_spellsuggest_option_methods()
178 set spell
179
Bram Moolenaar76734052019-12-26 14:30:15 +0100180 for e in ['latin1', 'utf-8']
181 exe 'set encoding=' .. e
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100182
Bram Moolenaar76734052019-12-26 14:30:15 +0100183 set spellsuggest=fast
184 call assert_equal(['Stick', 'Stitch'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100185
Bram Moolenaar76734052019-12-26 14:30:15 +0100186 " With best or double option, "Stitch" should become the top suggestion
187 " because of better phonetic matching.
188 set spellsuggest=best
189 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100190
Bram Moolenaar76734052019-12-26 14:30:15 +0100191 set spellsuggest=double
192 call assert_equal(['Stitch', 'Stick'], spellsuggest('Stich', 2), e)
193 endfor
194
195 set spell& spellsuggest& encoding&
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100196endfunc
197
198" Test 'spellsuggest' option with value file:{filename}
199func Test_spellsuggest_option_file()
200 set spell spellsuggest=file:Xspellsuggest
201 call writefile(['emacs/vim',
202 \ 'theribal/terrible',
203 \ 'teribal/terrrible',
204 \ 'terribal'],
205 \ 'Xspellsuggest')
206
207 call assert_equal(['vim'], spellsuggest('emacs', 2))
208 call assert_equal(['terrible'], spellsuggest('theribal',2))
209
210 " If the suggestion is misspelled (*terrrible* with 3 r),
211 " it should not be proposed.
212 " The entry for "terribal" should be ignored because of missing slash.
213 call assert_equal([], spellsuggest('teribal', 2))
214 call assert_equal([], spellsuggest('terribal', 2))
215
216 set spell spellsuggest=best,file:Xspellsuggest
217 call assert_equal(['vim', 'Emacs'], spellsuggest('emacs', 2))
218 call assert_equal(['terrible', 'tribal'], spellsuggest('theribal', 2))
219 call assert_equal(['tribal'], spellsuggest('teribal', 1))
220 call assert_equal(['tribal'], spellsuggest('terribal', 1))
221
222 call delete('Xspellsuggest')
223 call assert_fails("call spellsuggest('vim')", "E484: Can't open file Xspellsuggest")
224
225 set spellsuggest& spell&
226endfunc
227
228" Test 'spellsuggest' option with value {number}
229" to limit the number of suggestions
230func Test_spellsuggest_option_number()
231 set spell spellsuggest=2,best
232 new
233
234 " We limited the number of suggestions to 2, so selecting
235 " the 1st and 2nd suggestion should correct the word, but
236 " selecting a 3rd suggestion should do nothing.
Bram Moolenaar76734052019-12-26 14:30:15 +0100237 call setline(1, 'A baord')
238 norm $1z=
239 call assert_equal('A board', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100240
Bram Moolenaar76734052019-12-26 14:30:15 +0100241 call setline(1, 'A baord')
242 norm $2z=
243 call assert_equal('A bard', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100244
Bram Moolenaar76734052019-12-26 14:30:15 +0100245 call setline(1, 'A baord')
246 norm $3z=
247 call assert_equal('A baord', getline(1))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100248
Bram Moolenaar76734052019-12-26 14:30:15 +0100249 let a = execute('norm $z=')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100250 call assert_equal(
251 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100252 \ .. "Change \"baord\" to:\n"
253 \ .. " 1 \"board\"\n"
254 \ .. " 2 \"bard\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200255 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100256
257 set spell spellsuggest=0
Bram Moolenaar76734052019-12-26 14:30:15 +0100258 call assert_equal("\nSorry, no suggestions", execute('norm $z='))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100259
260 " Unlike z=, function spellsuggest(...) should not be affected by the
261 " max number of suggestions (2) set by the 'spellsuggest' option.
Bram Moolenaar76734052019-12-26 14:30:15 +0100262 call assert_equal(['board', 'bard', 'broad'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100263
264 set spellsuggest& spell&
265 bwipe!
266endfunc
267
268" Test 'spellsuggest' option with value expr:{expr}
269func Test_spellsuggest_option_expr()
270 " A silly 'spellsuggest' function which makes suggestions all uppercase
271 " and makes the score of each suggestion the length of the suggested word.
272 " So shorter suggestions are preferred.
273 func MySuggest()
274 let spellsuggest_save = &spellsuggest
Bram Moolenaar76734052019-12-26 14:30:15 +0100275 set spellsuggest=3,best
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100276 let result = map(spellsuggest(v:val, 3), "[toupper(v:val), len(v:val)]")
277 let &spellsuggest = spellsuggest_save
278 return result
279 endfunc
280
Bram Moolenaar76734052019-12-26 14:30:15 +0100281 set spell spellsuggest=expr:MySuggest()
282 call assert_equal(['BARD', 'BOARD', 'BROAD'], spellsuggest('baord', 3))
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100283
284 new
Bram Moolenaar76734052019-12-26 14:30:15 +0100285 call setline(1, 'baord')
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100286 let a = execute('norm z=')
287 call assert_equal(
288 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100289 \ .. "Change \"baord\" to:\n"
290 \ .. " 1 \"BARD\"\n"
291 \ .. " 2 \"BOARD\"\n"
292 \ .. " 3 \"BROAD\"\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200293 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100294
295 " With verbose, z= should show the score i.e. word length with
296 " our SpellSuggest() function.
297 set verbose=1
298 let a = execute('norm z=')
299 call assert_equal(
300 \ "\n"
Bram Moolenaar76734052019-12-26 14:30:15 +0100301 \ .. "Change \"baord\" to:\n"
302 \ .. " 1 \"BARD\" (4 - 0)\n"
303 \ .. " 2 \"BOARD\" (5 - 0)\n"
304 \ .. " 3 \"BROAD\" (5 - 0)\n"
Bram Moolenaard281b7c2020-06-10 16:39:32 +0200305 \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
Bram Moolenaare9a8d1f2019-12-25 13:36:36 +0100306
307 set spell& spellsuggest& verbose&
308 bwipe!
309endfunc
310
Bram Moolenaar8dfcce32020-03-18 19:32:26 +0100311" Test for 'spellsuggest' expr errrors
312func Test_spellsuggest_expr_errors()
313 " 'spellsuggest'
314 func MySuggest()
315 return range(3)
316 endfunc
317 set spell spellsuggest=expr:MySuggest()
318 call assert_equal([], spellsuggest('baord', 3))
319
320 " Test for 'spellsuggest' expression returning a non-list value
321 func! MySuggest2()
322 return 'good'
323 endfunc
324 set spellsuggest=expr:MySuggest2()
325 call assert_equal([], spellsuggest('baord'))
326
327 " Test for 'spellsuggest' expression returning a list with dict values
328 func! MySuggest3()
329 return [[{}, {}]]
330 endfunc
331 set spellsuggest=expr:MySuggest3()
332 call assert_fails("call spellsuggest('baord')", 'E728:')
333
334 set nospell spellsuggest&
335 delfunc MySuggest
336 delfunc MySuggest2
337 delfunc MySuggest3
338endfunc
339
Bram Moolenaar9049b682018-08-31 22:26:53 +0200340func Test_spellinfo()
341 new
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200342 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
Bram Moolenaar9049b682018-08-31 22:26:53 +0200343
344 set enc=latin1 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200345 call assert_match("^\nfile: " .. runtime .. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200346
347 set enc=cp1250 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200348 call assert_match("^\nfile: " .. runtime .. "/spell/en.ascii.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200349
Bram Moolenaar30276f22019-01-24 17:59:39 +0100350 set enc=utf-8 spell spelllang=en
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200351 call assert_match("^\nfile: " .. runtime .. "/spell/en.utf-8.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200352
353 set enc=latin1 spell spelllang=en_us,en_nz
354 call assert_match("^\n" .
Bram Moolenaarc25e7022019-10-10 14:08:26 +0200355 \ "file: " .. runtime .. "/spell/en.latin1.spl\n" .
356 \ "file: " .. runtime.. "/spell/en.latin1.spl\n$", execute('spellinfo'))
Bram Moolenaar9049b682018-08-31 22:26:53 +0200357
358 set spell spelllang=
359 call assert_fails('spellinfo', 'E756:')
360
361 set nospell spelllang=en
362 call assert_fails('spellinfo', 'E756:')
363
Bram Moolenaar8f130ed2019-04-10 22:15:19 +0200364 call assert_fails('set spelllang=foo/bar', 'E474:')
365 call assert_fails('set spelllang=foo\ bar', 'E474:')
366 call assert_fails("set spelllang=foo\\\nbar", 'E474:')
367 call assert_fails("set spelllang=foo\\\rbar", 'E474:')
368 call assert_fails("set spelllang=foo+bar", 'E474:')
369
Bram Moolenaar9049b682018-08-31 22:26:53 +0200370 set enc& spell& spelllang&
371 bwipe
372endfunc
373
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200374func Test_zz_basic()
375 call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
376 call RunGoodBad("wrong OK puts. Test the end",
377 \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
378 \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
379 \ "test", "testen", "testn", "the end", "uk", "wrong"],
380 \[
381 \ ["bad", ["put", "uk", "OK"]],
382 \ ["inputs", ["input", "puts", "outputs"]],
383 \ ["comment", ["Comment", "outtest", "the end"]],
384 \ ["ok", ["OK", "uk", "put"]],
385 \ ["Ok", ["OK", "Uk", "Put"]],
386 \ ["test", ["Test", "testn", "testen"]],
387 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
388 \ ["end", ["put", "uk", "test"]],
389 \ ["the", ["put", "uk", "test"]],
390 \ ]
391 \ )
392
393 call assert_equal("gebletegek", soundfold('goobledygoook'))
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200394 call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200395 call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
396endfunc
397
398" Postponed prefixes
399func Test_zz_prefixes()
400 call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
401 call RunGoodBad("puts",
402 \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
403 \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
404 \ [
405 \ ["bad", ["put", "uk", "OK"]],
406 \ ["inputs", ["input", "puts", "outputs"]],
407 \ ["comment", ["Comment"]],
408 \ ["ok", ["OK", "uk", "put"]],
409 \ ["Ok", ["OK", "Uk", "Put"]],
410 \ ["end", ["put", "uk", "deol"]],
411 \ ["the", ["put", "uk", "test"]],
412 \ ["test", ["Test", "testn", "testen"]],
413 \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
414 \ ])
415endfunc
416
417"Compound words
418func Test_zz_compound()
419 call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
420 call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
421 \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
422 \ ["foo", "m\xEF"],
423 \ [
424 \ ["bad", ["foo", "m\xEF"]],
425 \ ["bar", ["barfoo", "foobar", "foo"]],
426 \ ["la", ["m\xEF", "foo"]],
427 \ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
428 \ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
429 \ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
430 \ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
431 \ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
432 \ ["lala", []],
433 \ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
434 \ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
435 \ ["foola", ["foo", "foobar", "foofoo"]],
436 \ ["labar", ["barbar", "foobar"]],
437 \ ])
438
439 call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
440 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",
441 \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword",
442 \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
443 \ [
444 \ ["bad", ["end", "bork", "word"]],
445 \ ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
446 \ ["pro", ["bork", "word", "end"]],
447 \ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
448 \ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
449 \ ["endstart", ["end start", "start"]],
450 \ ["endend", ["end end", "end"]],
451 \ ["startstart", ["start start"]],
452 \ ["wordend", ["word end", "word", "wordword"]],
453 \ ["wordstart", ["word start", "bork start"]],
454 \ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
455 \ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
456 \ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
457 \ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
458 \ ["utilsbork", ["utilbork", "utils bork", "util bork"]],
459 \ ["startnouword", ["start nouword", "startword", "startborkword"]],
460 \ ])
461
462endfunc
463
464"Test affix flags with two characters
465func Test_zz_affix()
466 call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
467 call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend",
468 \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
469 \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
470 \ [
471 \ ["bad", ["bar", "end", "fooa1"]],
472 \ ["foo", ["fooa1", "fooa\xE9", "bar"]],
473 \ ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
474 \ ["prabar", ["prebar", "bar", "bar bar"]],
475 \ ["probarbirk", ["prebarbork"]],
476 \ ["middle", []],
477 \ ["startmiddle", ["startmiddleend", "startmiddlebar"]],
478 \ ["middleend", []],
479 \ ["endstart", ["end start", "start"]],
480 \ ["startprobar", ["startprebar", "start prebar", "startbar"]],
481 \ ["startnouend", ["start nouend", "startend"]],
482 \ ])
483
484 call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
485 call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend",
486 \ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
487 \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
488 \ [
489 \ ["bad", ["bar", "end", "lead"]],
490 \ ["mee", ["meea1", "meea\xE9", "bar"]],
491 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
492 \ ["prabar", ["prebar", "bar", "leadbar"]],
493 \ ["probarbirk", ["prebarbork"]],
494 \ ["middle", []],
495 \ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
496 \ ["middleend", []],
497 \ ["endlead", ["end lead", "lead", "end end"]],
498 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
499 \ ])
500
501 call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100502 call RunGoodBad("meea1 meezero meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200503 \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100504 \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "meezero", "prebar", "prebarmeat", "tail"],
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200505 \ [
506 \ ["bad", ["bar", "lead", "tail"]],
507 \ ["mee", ["meea1", "meea\xE9", "bar"]],
508 \ ["meea2", ["meea1", "meea\xE9", "lead"]],
509 \ ["prabar", ["prebar", "bar", "leadbar"]],
510 \ ["probarmaat", ["prebarmeat"]],
511 \ ["middle", []],
512 \ ["leadmiddle", ["leadmiddlebar"]],
513 \ ["middletail", []],
514 \ ["taillead", ["tail lead", "tail"]],
515 \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
516 \ ])
517endfunc
518
519func Test_zz_NOSLITSUGS()
520 call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
521 call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
522 \ ["bar", "faabar", "foo"],
523 \ [
524 \ ["bad", ["bar", "foo"]],
525 \ ["foobar", ["faabar", "foo bar", "bar"]],
526 \ ["barfoo", ["bar foo", "bar", "foo"]],
527 \ ])
528endfunc
529
530" Numbers
531func Test_zz_Numbers()
532 call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
533 call RunGoodBad("0b1011 0777 1234 0x01ff", "",
534 \ ["bar", "foo"],
535 \ [
536 \ ])
537endfunc
538
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +0100539" Affix flags
540func Test_zz_affix_flags()
541 call LoadAffAndDic(g:test_data_aff10, g:test_data_dic10)
542 call RunGoodBad("drink drinkable drinkables drinktable drinkabletable",
543 \ "bad: drinks drinkstable drinkablestable",
544 \ ["drink", "drinkable", "drinkables", "table"],
545 \ [['bad', []],
546 \ ['drinks', ['drink']],
547 \ ['drinkstable', ['drinktable', 'drinkable', 'drink table']],
548 \ ['drinkablestable', ['drinkabletable', 'drinkables table', 'drinkable table']],
549 \ ])
550endfunc
551
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200552function FirstSpellWord()
553 call feedkeys("/^start:\n", 'tx')
554 normal ]smm
555 let [str, a] = spellbadword()
556 return str
557endfunc
558
559function SecondSpellWord()
560 normal `m]s
561 let [str, a] = spellbadword()
562 return str
563endfunc
564
565"Test with SAL instead of SOFO items; test automatic reloading
566func Test_zz_sal_and_addition()
567 set enc=latin1
568 set spellfile=
Bram Moolenaar1a0f2002017-07-28 15:38:10 +0200569 call writefile(g:test_data_dic1, "Xtest.dic")
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200570 call writefile(g:test_data_aff_sal, "Xtest.aff")
571 mkspell! Xtest Xtest
572 set spl=Xtest.latin1.spl spell
573 call assert_equal('kbltykk', soundfold('goobledygoook'))
574 call assert_equal('kprnfn', soundfold('kóopërÿnôven'))
575 call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
576
577 "also use an addition file
578 call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add")
579 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
580
581 bwipe!
582 call setline(1, ["start: elequint test elekwint test elekwent asdf"])
583
584 set spellfile=Xtest.latin1.add
585 call assert_equal("elekwent", FirstSpellWord())
586
587 set spl=Xtest_us.latin1.spl
588 call assert_equal("elequint", FirstSpellWord())
589 call assert_equal("elekwint", SecondSpellWord())
590
591 set spl=Xtest_gb.latin1.spl
592 call assert_equal("elekwint", FirstSpellWord())
593 call assert_equal("elekwent", SecondSpellWord())
594
595 set spl=Xtest_nz.latin1.spl
596 call assert_equal("elequint", FirstSpellWord())
597 call assert_equal("elekwent", SecondSpellWord())
598
599 set spl=Xtest_ca.latin1.spl
600 call assert_equal("elequint", FirstSpellWord())
601 call assert_equal("elekwint", SecondSpellWord())
602endfunc
603
Bram Moolenaar862f1e12019-04-10 22:33:41 +0200604func Test_spellfile_value()
605 set spellfile=Xdir/Xtest.latin1.add
606 set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
607endfunc
608
Bram Moolenaaree03b942017-10-27 00:57:05 +0200609func Test_region_error()
610 messages clear
611 call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add")
612 mkspell! Xtest.latin1.add.spl Xtest.latin1.add
613 call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
614 call delete('Xtest.latin1.add')
615 call delete('Xtest.latin1.add.spl')
616endfunc
617
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200618" Check using z= in new buffer (crash fixed by patch 7.4a.028).
619func Test_zeq_crash()
620 new
621 set maxmem=512 spell
622 call feedkeys('iasdz=:\"', 'tx')
623
624 bwipe!
625endfunc
626
Bram Moolenaar152e79e2020-06-10 15:32:08 +0200627" Check that z= works even when 'nospell' is set. This test uses one of the
628" tests in Test_spellsuggest_option_number() just to verify that z= basically
629" works and that "E756: Spell checking is not enabled" is not generated.
630func Test_zeq_nospell()
631 new
632 set nospell spellsuggest=1,best
633 call setline(1, 'A baord')
634 try
635 norm $1z=
636 call assert_equal('A board', getline(1))
637 catch
638 call assert_report("Caught exception: " . v:exception)
639 endtry
640 set spell& spellsuggest&
641 bwipe!
642endfunc
643
644" Check that "E756: Spell checking is not possible" is reported when z= is
645" executed and 'spelllang' is empty.
646func Test_zeq_no_spelllang()
647 new
648 set spelllang= spellsuggest=1,best
649 call setline(1, 'A baord')
650 call assert_fails('normal $1z=', 'E756:')
651 set spelllang& spellsuggest&
652 bwipe!
653endfunc
654
Bram Moolenaar5bcc5a12019-08-06 22:48:02 +0200655" Check handling a word longer than MAXWLEN.
656func Test_spell_long_word()
657 set enc=utf-8
658 new
659 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")
660 set spell spelllang=en
661 redraw
662 redraw!
663 bwipe!
664 set nospell
665endfunc
666
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200667func LoadAffAndDic(aff_contents, dic_contents)
668 set enc=latin1
669 set spellfile=
670 call writefile(a:aff_contents, "Xtest.aff")
671 call writefile(a:dic_contents, "Xtest.dic")
672 " Generate a .spl file from a .dic and .aff file.
673 mkspell! Xtest Xtest
674 " use that spell file
675 set spl=Xtest.latin1.spl spell
676endfunc
677
678func ListWords()
679 spelldump
680 %yank
681 quit
682 return split(@", "\n")
683endfunc
684
685func TestGoodBadBase()
686 exe '1;/^good:'
687 normal 0f:]s
688 let prevbad = ''
689 let result = []
690 while 1
691 let [bad, a] = spellbadword()
692 if bad == '' || bad == prevbad || bad == 'badend'
693 break
694 endif
695 let prevbad = bad
Bram Moolenaarf6ed61e2019-09-07 19:05:09 +0200696 let lst = bad->spellsuggest(3)
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200697 normal mm
698
699 call add(result, [bad, lst])
700 normal `m]s
701 endwhile
702 return result
703endfunc
704
705func RunGoodBad(good, bad, expected_words, expected_bad_words)
706 bwipe!
707 call setline(1, ["good: ", a:good, a:bad, " badend "])
708 let words = ListWords()
709 call assert_equal(a:expected_words, words[1:-1])
710 let bad_words = TestGoodBadBase()
711 call assert_equal(a:expected_bad_words, bad_words)
712 bwipe!
713endfunc
714
Bram Moolenaar7751d1d2019-10-18 20:37:08 +0200715func Test_spell_screendump()
716 CheckScreendump
717
718 let lines =<< trim END
719 call setline(1, [
720 \ "This is some text without any spell errors. Everything",
721 \ "should just be black, nothing wrong here.",
722 \ "",
723 \ "This line has a sepll error. and missing caps.",
724 \ "And and this is the the duplication.",
725 \ "with missing caps here.",
726 \ ])
727 set spell spelllang=en_nz
728 END
729 call writefile(lines, 'XtestSpell')
730 let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
731 call VerifyScreenDump(buf, 'Test_spell_1', {})
732
733 " clean up
734 call StopVimInTerminal(buf)
735 call delete('XtestSpell')
736endfunc
737
Bram Moolenaard2c061d2017-06-22 21:42:49 +0200738let g:test_data_aff1 = [
739 \"SET ISO8859-1",
740 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
741 \"",
742 \"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",
743 \"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",
744 \"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",
745 \"",
746 \"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",
747 \"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
748 \"",
749 \"MIDWORD\t'-",
750 \"",
751 \"KEP =",
752 \"RAR ?",
753 \"BAD !",
754 \"",
755 \"PFX I N 1",
756 \"PFX I 0 in .",
757 \"",
758 \"PFX O Y 1",
759 \"PFX O 0 out .",
760 \"",
761 \"SFX S Y 2",
762 \"SFX S 0 s [^s]",
763 \"SFX S 0 es s",
764 \"",
765 \"SFX N N 3",
766 \"SFX N 0 en [^n]",
767 \"SFX N 0 nen n",
768 \"SFX N 0 n .",
769 \"",
770 \"REP 3",
771 \"REP g ch",
772 \"REP ch g",
773 \"REP svp s.v.p.",
774 \"",
775 \"MAP 9",
776 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
777 \"MAP e\xE8\xE9\xEA\xEB",
778 \"MAP i\xEC\xED\xEE\xEF",
779 \"MAP o\xF2\xF3\xF4\xF5\xF6",
780 \"MAP u\xF9\xFA\xFB\xFC",
781 \"MAP n\xF1",
782 \"MAP c\xE7",
783 \"MAP y\xFF\xFD",
784 \"MAP s\xDF",
785 \ ]
786let g:test_data_dic1 = [
787 \"123456",
788 \"test/NO",
789 \"# comment",
790 \"wrong",
791 \"Comment",
792 \"OK",
793 \"uk",
794 \"put/ISO",
795 \"the end",
796 \"deol",
797 \"d\xE9\xF4r",
798 \ ]
799let g:test_data_aff2 = [
800 \"SET ISO8859-1",
801 \"",
802 \"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",
803 \"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",
804 \"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",
805 \"",
806 \"PFXPOSTPONE",
807 \"",
808 \"MIDWORD\t'-",
809 \"",
810 \"KEP =",
811 \"RAR ?",
812 \"BAD !",
813 \"",
814 \"PFX I N 1",
815 \"PFX I 0 in .",
816 \"",
817 \"PFX O Y 1",
818 \"PFX O 0 out [a-z]",
819 \"",
820 \"SFX S Y 2",
821 \"SFX S 0 s [^s]",
822 \"SFX S 0 es s",
823 \"",
824 \"SFX N N 3",
825 \"SFX N 0 en [^n]",
826 \"SFX N 0 nen n",
827 \"SFX N 0 n .",
828 \"",
829 \"REP 3",
830 \"REP g ch",
831 \"REP ch g",
832 \"REP svp s.v.p.",
833 \"",
834 \"MAP 9",
835 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
836 \"MAP e\xE8\xE9\xEA\xEB",
837 \"MAP i\xEC\xED\xEE\xEF",
838 \"MAP o\xF2\xF3\xF4\xF5\xF6",
839 \"MAP u\xF9\xFA\xFB\xFC",
840 \"MAP n\xF1",
841 \"MAP c\xE7",
842 \"MAP y\xFF\xFD",
843 \"MAP s\xDF",
844 \ ]
845let g:test_data_aff3 = [
846 \"SET ISO8859-1",
847 \"",
848 \"COMPOUNDMIN 3",
849 \"COMPOUNDRULE m*",
850 \"NEEDCOMPOUND x",
851 \ ]
852let g:test_data_dic3 = [
853 \"1234",
854 \"foo/m",
855 \"bar/mx",
856 \"m\xEF/m",
857 \"la/mx",
858 \ ]
859let g:test_data_aff4 = [
860 \"SET ISO8859-1",
861 \"",
862 \"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",
863 \"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",
864 \"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",
865 \"",
866 \"COMPOUNDRULE m+",
867 \"COMPOUNDRULE sm*e",
868 \"COMPOUNDRULE sm+",
869 \"COMPOUNDMIN 3",
870 \"COMPOUNDWORDMAX 3",
871 \"COMPOUNDFORBIDFLAG t",
872 \"",
873 \"COMPOUNDSYLMAX 5",
874 \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
875 \"",
876 \"MAP 9",
877 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
878 \"MAP e\xE8\xE9\xEA\xEB",
879 \"MAP i\xEC\xED\xEE\xEF",
880 \"MAP o\xF2\xF3\xF4\xF5\xF6",
881 \"MAP u\xF9\xFA\xFB\xFC",
882 \"MAP n\xF1",
883 \"MAP c\xE7",
884 \"MAP y\xFF\xFD",
885 \"MAP s\xDF",
886 \"",
887 \"NEEDAFFIX x",
888 \"",
889 \"PFXPOSTPONE",
890 \"",
891 \"MIDWORD '-",
892 \"",
893 \"SFX q N 1",
894 \"SFX q 0 -ok .",
895 \"",
896 \"SFX a Y 2",
897 \"SFX a 0 s .",
898 \"SFX a 0 ize/t .",
899 \"",
900 \"PFX p N 1",
901 \"PFX p 0 pre .",
902 \"",
903 \"PFX P N 1",
904 \"PFX P 0 nou .",
905 \ ]
906let g:test_data_dic4 = [
907 \"1234",
908 \"word/mP",
909 \"util/am",
910 \"pro/xq",
911 \"tomato/m",
912 \"bork/mp",
913 \"start/s",
914 \"end/e",
915 \ ]
916let g:test_data_aff5 = [
917 \"SET ISO8859-1",
918 \"",
919 \"FLAG long",
920 \"",
921 \"NEEDAFFIX !!",
922 \"",
923 \"COMPOUNDRULE ssmm*ee",
924 \"",
925 \"NEEDCOMPOUND xx",
926 \"COMPOUNDPERMITFLAG pp",
927 \"",
928 \"SFX 13 Y 1",
929 \"SFX 13 0 bork .",
930 \"",
931 \"SFX a1 Y 1",
932 \"SFX a1 0 a1 .",
933 \"",
934 \"SFX a\xE9 Y 1",
935 \"SFX a\xE9 0 a\xE9 .",
936 \"",
937 \"PFX zz Y 1",
938 \"PFX zz 0 pre/pp .",
939 \"",
940 \"PFX yy Y 1",
941 \"PFX yy 0 nou .",
942 \ ]
943let g:test_data_dic5 = [
944 \"1234",
945 \"foo/a1a\xE9!!",
946 \"bar/zz13ee",
947 \"start/ss",
948 \"end/eeyy",
949 \"middle/mmxx",
950 \ ]
951let g:test_data_aff6 = [
952 \"SET ISO8859-1",
953 \"",
954 \"FLAG caplong",
955 \"",
956 \"NEEDAFFIX A!",
957 \"",
958 \"COMPOUNDRULE sMm*Ee",
959 \"",
960 \"NEEDCOMPOUND Xx",
961 \"",
962 \"COMPOUNDPERMITFLAG p",
963 \"",
964 \"SFX N3 Y 1",
965 \"SFX N3 0 bork .",
966 \"",
967 \"SFX A1 Y 1",
968 \"SFX A1 0 a1 .",
969 \"",
970 \"SFX A\xE9 Y 1",
971 \"SFX A\xE9 0 a\xE9 .",
972 \"",
973 \"PFX Zz Y 1",
974 \"PFX Zz 0 pre/p .",
975 \ ]
976let g:test_data_dic6 = [
977 \"1234",
978 \"mee/A1A\xE9A!",
979 \"bar/ZzN3Ee",
980 \"lead/s",
981 \"end/Ee",
982 \"middle/MmXx",
983 \ ]
984let g:test_data_aff7 = [
985 \"SET ISO8859-1",
986 \"",
987 \"FLAG num",
988 \"",
989 \"NEEDAFFIX 9999",
990 \"",
991 \"COMPOUNDRULE 2,77*123",
992 \"",
993 \"NEEDCOMPOUND 1",
994 \"COMPOUNDPERMITFLAG 432",
995 \"",
996 \"SFX 61003 Y 1",
997 \"SFX 61003 0 meat .",
998 \"",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +0100999 \"SFX 0 Y 1",
1000 \"SFX 0 0 zero .",
1001 \"",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001002 \"SFX 391 Y 1",
1003 \"SFX 391 0 a1 .",
1004 \"",
1005 \"SFX 111 Y 1",
1006 \"SFX 111 0 a\xE9 .",
1007 \"",
1008 \"PFX 17 Y 1",
1009 \"PFX 17 0 pre/432 .",
1010 \ ]
1011let g:test_data_dic7 = [
1012 \"1234",
Bram Moolenaar3d2a47c2019-11-07 20:48:42 +01001013 \"mee/0,391,111,9999",
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001014 \"bar/17,61003,123",
1015 \"lead/2",
1016 \"tail/123",
1017 \"middle/77,1",
1018 \ ]
1019let g:test_data_aff8 = [
1020 \"SET ISO8859-1",
1021 \"",
1022 \"NOSPLITSUGS",
1023 \ ]
1024let g:test_data_dic8 = [
1025 \"1234",
1026 \"foo",
1027 \"bar",
1028 \"faabar",
1029 \ ]
1030let g:test_data_aff9 = [
1031 \ ]
1032let g:test_data_dic9 = [
1033 \"1234",
1034 \"foo",
1035 \"bar",
1036 \ ]
Bram Moolenaar37ff4cf2019-11-17 20:10:20 +01001037let g:test_data_aff10 = [
1038 \"COMPOUNDRULE se",
1039 \"COMPOUNDPERMITFLAG p",
1040 \"",
1041 \"SFX A Y 1",
1042 \"SFX A 0 able/Mp .",
1043 \"",
1044 \"SFX M Y 1",
1045 \"SFX M 0 s .",
1046 \ ]
1047let g:test_data_dic10 = [
1048 \"1234",
1049 \"drink/As",
1050 \"table/e",
1051 \ ]
Bram Moolenaard2c061d2017-06-22 21:42:49 +02001052let g:test_data_aff_sal = [
1053 \"SET ISO8859-1",
1054 \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
1055 \"",
1056 \"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",
1057 \"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",
1058 \"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",
1059 \"",
1060 \"MIDWORD\t'-",
1061 \"",
1062 \"KEP =",
1063 \"RAR ?",
1064 \"BAD !",
1065 \"",
1066 \"PFX I N 1",
1067 \"PFX I 0 in .",
1068 \"",
1069 \"PFX O Y 1",
1070 \"PFX O 0 out .",
1071 \"",
1072 \"SFX S Y 2",
1073 \"SFX S 0 s [^s]",
1074 \"SFX S 0 es s",
1075 \"",
1076 \"SFX N N 3",
1077 \"SFX N 0 en [^n]",
1078 \"SFX N 0 nen n",
1079 \"SFX N 0 n .",
1080 \"",
1081 \"REP 3",
1082 \"REP g ch",
1083 \"REP ch g",
1084 \"REP svp s.v.p.",
1085 \"",
1086 \"MAP 9",
1087 \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
1088 \"MAP e\xE8\xE9\xEA\xEB",
1089 \"MAP i\xEC\xED\xEE\xEF",
1090 \"MAP o\xF2\xF3\xF4\xF5\xF6",
1091 \"MAP u\xF9\xFA\xFB\xFC",
1092 \"MAP n\xF1",
1093 \"MAP c\xE7",
1094 \"MAP y\xFF\xFD",
1095 \"MAP s\xDF",
1096 \"",
1097 \"SAL AH(AEIOUY)-^ *H",
1098 \"SAL AR(AEIOUY)-^ *R",
1099 \"SAL A(HR)^ *",
1100 \"SAL A^ *",
1101 \"SAL AH(AEIOUY)- H",
1102 \"SAL AR(AEIOUY)- R",
1103 \"SAL A(HR) _",
1104 \"SAL \xC0^ *",
1105 \"SAL \xC5^ *",
1106 \"SAL BB- _",
1107 \"SAL B B",
1108 \"SAL CQ- _",
1109 \"SAL CIA X",
1110 \"SAL CH X",
1111 \"SAL C(EIY)- S",
1112 \"SAL CK K",
1113 \"SAL COUGH^ KF",
1114 \"SAL CC< C",
1115 \"SAL C K",
1116 \"SAL DG(EIY) K",
1117 \"SAL DD- _",
1118 \"SAL D T",
1119 \"SAL \xC9< E",
1120 \"SAL EH(AEIOUY)-^ *H",
1121 \"SAL ER(AEIOUY)-^ *R",
1122 \"SAL E(HR)^ *",
1123 \"SAL ENOUGH^$ *NF",
1124 \"SAL E^ *",
1125 \"SAL EH(AEIOUY)- H",
1126 \"SAL ER(AEIOUY)- R",
1127 \"SAL E(HR) _",
1128 \"SAL FF- _",
1129 \"SAL F F",
1130 \"SAL GN^ N",
1131 \"SAL GN$ N",
1132 \"SAL GNS$ NS",
1133 \"SAL GNED$ N",
1134 \"SAL GH(AEIOUY)- K",
1135 \"SAL GH _",
1136 \"SAL GG9 K",
1137 \"SAL G K",
1138 \"SAL H H",
1139 \"SAL IH(AEIOUY)-^ *H",
1140 \"SAL IR(AEIOUY)-^ *R",
1141 \"SAL I(HR)^ *",
1142 \"SAL I^ *",
1143 \"SAL ING6 N",
1144 \"SAL IH(AEIOUY)- H",
1145 \"SAL IR(AEIOUY)- R",
1146 \"SAL I(HR) _",
1147 \"SAL J K",
1148 \"SAL KN^ N",
1149 \"SAL KK- _",
1150 \"SAL K K",
1151 \"SAL LAUGH^ LF",
1152 \"SAL LL- _",
1153 \"SAL L L",
1154 \"SAL MB$ M",
1155 \"SAL MM M",
1156 \"SAL M M",
1157 \"SAL NN- _",
1158 \"SAL N N",
1159 \"SAL OH(AEIOUY)-^ *H",
1160 \"SAL OR(AEIOUY)-^ *R",
1161 \"SAL O(HR)^ *",
1162 \"SAL O^ *",
1163 \"SAL OH(AEIOUY)- H",
1164 \"SAL OR(AEIOUY)- R",
1165 \"SAL O(HR) _",
1166 \"SAL PH F",
1167 \"SAL PN^ N",
1168 \"SAL PP- _",
1169 \"SAL P P",
1170 \"SAL Q K",
1171 \"SAL RH^ R",
1172 \"SAL ROUGH^ RF",
1173 \"SAL RR- _",
1174 \"SAL R R",
1175 \"SAL SCH(EOU)- SK",
1176 \"SAL SC(IEY)- S",
1177 \"SAL SH X",
1178 \"SAL SI(AO)- X",
1179 \"SAL SS- _",
1180 \"SAL S S",
1181 \"SAL TI(AO)- X",
1182 \"SAL TH @",
1183 \"SAL TCH-- _",
1184 \"SAL TOUGH^ TF",
1185 \"SAL TT- _",
1186 \"SAL T T",
1187 \"SAL UH(AEIOUY)-^ *H",
1188 \"SAL UR(AEIOUY)-^ *R",
1189 \"SAL U(HR)^ *",
1190 \"SAL U^ *",
1191 \"SAL UH(AEIOUY)- H",
1192 \"SAL UR(AEIOUY)- R",
1193 \"SAL U(HR) _",
1194 \"SAL V^ W",
1195 \"SAL V F",
1196 \"SAL WR^ R",
1197 \"SAL WH^ W",
1198 \"SAL W(AEIOU)- W",
1199 \"SAL X^ S",
1200 \"SAL X KS",
1201 \"SAL Y(AEIOU)- Y",
1202 \"SAL ZZ- _",
1203 \"SAL Z S",
1204 \ ]
Bram Moolenaar0e05de42020-03-25 22:23:46 +01001205
1206" vim: shiftwidth=2 sts=2 expandtab