xref: /vim-8.2.3635/src/testdir/test_spell.vim (revision 8fe1000e)
1" Test spell checking
2" Note: this file uses latin1 encoding, but is used with utf-8 encoding.
3
4source check.vim
5CheckFeature spell
6
7func TearDown()
8  set nospell
9  call delete('Xtest.aff')
10  call delete('Xtest.dic')
11  call delete('Xtest.latin1.add')
12  call delete('Xtest.latin1.add.spl')
13  call delete('Xtest.latin1.spl')
14  call delete('Xtest.latin1.sug')
15endfunc
16
17func Test_wrap_search()
18  new
19  call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End'])
20  set spell wrapscan
21  normal ]s
22  call assert_equal('plong', expand('<cword>'))
23  normal ]s
24  call assert_equal('zpelling', expand('<cword>'))
25  normal ]s
26  call assert_equal('plong', expand('<cword>'))
27  bwipe!
28  set nospell
29endfunc
30
31func Test_curswant()
32  new
33  call setline(1, ['Another plong line', 'abcdefghijklmnopq'])
34  set spell wrapscan
35  normal 0]s
36  call assert_equal('plong', expand('<cword>'))
37  normal j
38  call assert_equal(9, getcurpos()[2])
39  normal 0[s
40  call assert_equal('plong', expand('<cword>'))
41  normal j
42  call assert_equal(9, getcurpos()[2])
43
44  normal 0]S
45  call assert_equal('plong', expand('<cword>'))
46  normal j
47  call assert_equal(9, getcurpos()[2])
48  normal 0[S
49  call assert_equal('plong', expand('<cword>'))
50  normal j
51  call assert_equal(9, getcurpos()[2])
52
53  normal 1G0
54  call assert_equal('plong', spellbadword()[0])
55  normal j
56  call assert_equal(9, getcurpos()[2])
57
58  bwipe!
59  set nospell
60endfunc
61
62func Test_z_equal_on_invalid_utf8_word()
63  split
64  set spell
65  call setline(1, "\xff")
66  norm z=
67  set nospell
68  bwipe!
69endfunc
70
71" Test spellbadword() with argument
72func Test_spellbadword()
73  set spell
74
75  call assert_equal(['bycycle', 'bad'],  spellbadword('My bycycle.'))
76  call assert_equal(['another', 'caps'], 'A sentence. another sentence'->spellbadword())
77
78  set spelllang=en
79  call assert_equal(['', ''],            spellbadword('centre'))
80  call assert_equal(['', ''],            spellbadword('center'))
81  set spelllang=en_us
82  call assert_equal(['centre', 'local'], spellbadword('centre'))
83  call assert_equal(['', ''],            spellbadword('center'))
84  set spelllang=en_gb
85  call assert_equal(['', ''],            spellbadword('centre'))
86  call assert_equal(['center', 'local'], spellbadword('center'))
87
88  " Create a small word list to test that spellbadword('...')
89  " can return ['...', 'rare'].
90  e Xwords
91  insert
92foo
93foobar/?
94.
95   w!
96   mkspell! Xwords.spl Xwords
97   set spelllang=Xwords.spl
98   call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
99
100  " Typo should not be detected without the 'spell' option.
101  set spelllang=en_gb nospell
102  call assert_equal(['', ''], spellbadword('centre'))
103  call assert_equal(['', ''], spellbadword('My bycycle.'))
104  call assert_equal(['', ''], spellbadword('A sentence. another sentence'))
105
106  call delete('Xwords.spl')
107  call delete('Xwords')
108  set spelllang&
109  set spell&
110endfunc
111
112func Test_spellreall()
113  new
114  set spell
115  call assert_fails('spellrepall', 'E752:')
116  call setline(1, ['A speling mistake. The same speling mistake.',
117        \                'Another speling mistake.'])
118  call feedkeys(']s1z=', 'tx')
119  call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
120  call assert_equal('Another speling mistake.', getline(2))
121  spellrepall
122  call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
123  call assert_equal('Another spelling mistake.', getline(2))
124  call assert_fails('spellrepall', 'E753:')
125  set spell&
126  bwipe!
127endfunc
128
129func Test_spellinfo()
130  new
131
132  set enc=latin1 spell spelllang=en
133  call assert_match("^\nfile: .*/runtime/spell/en.latin1.spl\n$", execute('spellinfo'))
134
135  set enc=cp1250 spell spelllang=en
136  call assert_match("^\nfile: .*/runtime/spell/en.ascii.spl\n$", execute('spellinfo'))
137
138  set enc=utf-8 spell spelllang=en
139  call assert_match("^\nfile: .*/runtime/spell/en.utf-8.spl\n$", execute('spellinfo'))
140
141  set enc=latin1 spell spelllang=en_us,en_nz
142  call assert_match("^\n" .
143                 \  "file: .*/runtime/spell/en.latin1.spl\n" .
144                 \  "file: .*/runtime/spell/en.latin1.spl\n$", execute('spellinfo'))
145
146  set spell spelllang=
147  call assert_fails('spellinfo', 'E756:')
148
149  set nospell spelllang=en
150  call assert_fails('spellinfo', 'E756:')
151
152  call assert_fails('set spelllang=foo/bar', 'E474:')
153  call assert_fails('set spelllang=foo\ bar', 'E474:')
154  call assert_fails("set spelllang=foo\\\nbar", 'E474:')
155  call assert_fails("set spelllang=foo\\\rbar", 'E474:')
156  call assert_fails("set spelllang=foo+bar", 'E474:')
157
158  set enc& spell& spelllang&
159  bwipe
160endfunc
161
162func Test_zz_basic()
163  call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
164  call RunGoodBad("wrong OK puts. Test the end",
165        \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
166        \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
167        \  "test", "testen", "testn", "the end", "uk", "wrong"],
168        \[
169        \   ["bad", ["put", "uk", "OK"]],
170        \   ["inputs", ["input", "puts", "outputs"]],
171        \   ["comment", ["Comment", "outtest", "the end"]],
172        \   ["ok", ["OK", "uk", "put"]],
173        \   ["Ok", ["OK", "Uk", "Put"]],
174        \   ["test", ["Test", "testn", "testen"]],
175        \   ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
176        \   ["end", ["put", "uk", "test"]],
177        \   ["the", ["put", "uk", "test"]],
178        \ ]
179        \ )
180
181  call assert_equal("gebletegek", soundfold('goobledygoook'))
182  call assert_equal("kepereneven", 'k�op�r�n�ven'->soundfold())
183  call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
184endfunc
185
186" Postponed prefixes
187func Test_zz_prefixes()
188  call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
189  call RunGoodBad("puts",
190        \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
191        \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
192        \ [
193        \   ["bad", ["put", "uk", "OK"]],
194        \   ["inputs", ["input", "puts", "outputs"]],
195        \   ["comment", ["Comment"]],
196        \   ["ok", ["OK", "uk", "put"]],
197        \   ["Ok", ["OK", "Uk", "Put"]],
198        \   ["end", ["put", "uk", "deol"]],
199        \   ["the", ["put", "uk", "test"]],
200        \   ["test", ["Test", "testn", "testen"]],
201        \   ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
202        \ ])
203endfunc
204
205"Compound words
206func Test_zz_compound()
207  call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
208  call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
209        \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
210        \ ["foo", "m\xEF"],
211        \ [
212        \   ["bad", ["foo", "m\xEF"]],
213        \   ["bar", ["barfoo", "foobar", "foo"]],
214        \   ["la", ["m\xEF", "foo"]],
215        \   ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
216        \   ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
217        \   ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
218        \   ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
219        \   ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
220        \   ["lala", []],
221        \   ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
222        \   ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
223        \   ["foola", ["foo", "foobar", "foofoo"]],
224        \   ["labar", ["barbar", "foobar"]],
225        \ ])
226
227  call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
228  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",
229        \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork  preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork  startnouword",
230        \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
231        \ [
232        \   ["bad", ["end", "bork", "word"]],
233        \   ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
234        \   ["pro", ["bork", "word", "end"]],
235        \   ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
236        \   ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
237        \   ["endstart", ["end start", "start"]],
238        \   ["endend", ["end end", "end"]],
239        \   ["startstart", ["start start"]],
240        \   ["wordend", ["word end", "word", "wordword"]],
241        \   ["wordstart", ["word start", "bork start"]],
242        \   ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
243        \   ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
244        \   ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
245        \   ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
246        \   ["utilsbork", ["utilbork", "utils bork", "util bork"]],
247        \   ["startnouword", ["start nouword", "startword", "startborkword"]],
248        \ ])
249
250endfunc
251
252"Test affix flags with two characters
253func Test_zz_affix()
254  call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
255  call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork  startprebar start end startend  startmiddleend nouend",
256        \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
257        \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
258        \ [
259        \   ["bad", ["bar", "end", "fooa1"]],
260        \   ["foo", ["fooa1", "fooa\xE9", "bar"]],
261        \   ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
262        \   ["prabar", ["prebar", "bar", "bar bar"]],
263        \   ["probarbirk", ["prebarbork"]],
264        \   ["middle", []],
265        \   ["startmiddle", ["startmiddleend", "startmiddlebar"]],
266        \   ["middleend", []],
267        \   ["endstart", ["end start", "start"]],
268        \   ["startprobar", ["startprebar", "start prebar", "startbar"]],
269        \   ["startnouend", ["start nouend", "startend"]],
270        \ ])
271
272  call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
273  call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork  leadprebar lead end leadend  leadmiddleend",
274        \  "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
275        \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
276        \ [
277        \   ["bad", ["bar", "end", "lead"]],
278        \   ["mee", ["meea1", "meea\xE9", "bar"]],
279        \   ["meea2", ["meea1", "meea\xE9", "lead"]],
280        \   ["prabar", ["prebar", "bar", "leadbar"]],
281        \   ["probarbirk", ["prebarbork"]],
282        \   ["middle", []],
283        \   ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
284        \   ["middleend", []],
285        \   ["endlead", ["end lead", "lead", "end end"]],
286        \   ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
287        \ ])
288
289  call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
290  call RunGoodBad("meea1 meea\xE9 bar prebar barmeat prebarmeat  leadprebar lead tail leadtail  leadmiddletail",
291        \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
292        \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "prebar", "prebarmeat", "tail"],
293        \ [
294        \   ["bad", ["bar", "lead", "tail"]],
295        \   ["mee", ["meea1", "meea\xE9", "bar"]],
296        \   ["meea2", ["meea1", "meea\xE9", "lead"]],
297        \   ["prabar", ["prebar", "bar", "leadbar"]],
298        \   ["probarmaat", ["prebarmeat"]],
299        \   ["middle", []],
300        \   ["leadmiddle", ["leadmiddlebar"]],
301        \   ["middletail", []],
302        \   ["taillead", ["tail lead", "tail"]],
303        \   ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
304        \ ])
305endfunc
306
307func Test_zz_NOSLITSUGS()
308  call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
309  call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
310        \ ["bar", "faabar", "foo"],
311        \ [
312        \   ["bad", ["bar", "foo"]],
313        \   ["foobar", ["faabar", "foo bar", "bar"]],
314        \   ["barfoo", ["bar foo", "bar", "foo"]],
315        \ ])
316endfunc
317
318" Numbers
319func Test_zz_Numbers()
320  call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
321  call RunGoodBad("0b1011 0777 1234 0x01ff", "",
322        \ ["bar", "foo"],
323        \ [
324        \ ])
325endfunc
326
327function FirstSpellWord()
328  call feedkeys("/^start:\n", 'tx')
329  normal ]smm
330  let [str, a] = spellbadword()
331  return str
332endfunc
333
334function SecondSpellWord()
335  normal `m]s
336  let [str, a] = spellbadword()
337  return str
338endfunc
339
340"Test with SAL instead of SOFO items; test automatic reloading
341func Test_zz_sal_and_addition()
342  set enc=latin1
343  set spellfile=
344  call writefile(g:test_data_dic1, "Xtest.dic")
345  call writefile(g:test_data_aff_sal, "Xtest.aff")
346  mkspell! Xtest Xtest
347  set spl=Xtest.latin1.spl spell
348  call assert_equal('kbltykk', soundfold('goobledygoook'))
349  call assert_equal('kprnfn', soundfold('k�op�r�n�ven'))
350  call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
351
352  "also use an addition file
353  call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add")
354  mkspell! Xtest.latin1.add.spl Xtest.latin1.add
355
356  bwipe!
357  call setline(1, ["start: elequint test elekwint test elekwent asdf"])
358
359  set spellfile=Xtest.latin1.add
360  call assert_equal("elekwent", FirstSpellWord())
361
362  set spl=Xtest_us.latin1.spl
363  call assert_equal("elequint", FirstSpellWord())
364  call assert_equal("elekwint", SecondSpellWord())
365
366  set spl=Xtest_gb.latin1.spl
367  call assert_equal("elekwint", FirstSpellWord())
368  call assert_equal("elekwent", SecondSpellWord())
369
370  set spl=Xtest_nz.latin1.spl
371  call assert_equal("elequint", FirstSpellWord())
372  call assert_equal("elekwent", SecondSpellWord())
373
374  set spl=Xtest_ca.latin1.spl
375  call assert_equal("elequint", FirstSpellWord())
376  call assert_equal("elekwint", SecondSpellWord())
377endfunc
378
379func Test_spellfile_value()
380  set spellfile=Xdir/Xtest.latin1.add
381  set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
382endfunc
383
384func Test_region_error()
385  messages clear
386  call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add")
387  mkspell! Xtest.latin1.add.spl Xtest.latin1.add
388  call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
389  call delete('Xtest.latin1.add')
390  call delete('Xtest.latin1.add.spl')
391endfunc
392
393" Check using z= in new buffer (crash fixed by patch 7.4a.028).
394func Test_zeq_crash()
395  new
396  set maxmem=512 spell
397  call feedkeys('iasdz=:\"', 'tx')
398
399  bwipe!
400endfunc
401
402" Check handling a word longer than MAXWLEN.
403func Test_spell_long_word()
404  set enc=utf-8
405  new
406  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")
407  set spell spelllang=en
408  redraw
409  redraw!
410  bwipe!
411  set nospell
412endfunc
413
414func LoadAffAndDic(aff_contents, dic_contents)
415  set enc=latin1
416  set spellfile=
417  call writefile(a:aff_contents, "Xtest.aff")
418  call writefile(a:dic_contents, "Xtest.dic")
419  " Generate a .spl file from a .dic and .aff file.
420  mkspell! Xtest Xtest
421  " use that spell file
422  set spl=Xtest.latin1.spl spell
423endfunc
424
425func ListWords()
426  spelldump
427  %yank
428  quit
429  return split(@", "\n")
430endfunc
431
432func TestGoodBadBase()
433  exe '1;/^good:'
434  normal 0f:]s
435  let prevbad = ''
436  let result = []
437  while 1
438    let [bad, a] = spellbadword()
439    if bad == '' || bad == prevbad || bad == 'badend'
440      break
441    endif
442    let prevbad = bad
443    let lst = bad->spellsuggest(3)
444    normal mm
445
446    call add(result, [bad, lst])
447    normal `m]s
448  endwhile
449  return result
450endfunc
451
452func RunGoodBad(good, bad, expected_words, expected_bad_words)
453  bwipe!
454  call setline(1, ["good: ", a:good,  a:bad, " badend "])
455  let words = ListWords()
456  call assert_equal(a:expected_words, words[1:-1])
457  let bad_words = TestGoodBadBase()
458  call assert_equal(a:expected_bad_words, bad_words)
459  bwipe!
460endfunc
461
462let g:test_data_aff1 = [
463      \"SET ISO8859-1",
464      \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
465      \"",
466      \"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",
467      \"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",
468      \"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",
469      \"",
470      \"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",
471      \"SOFOTO   ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
472      \"",
473      \"MIDWORD\t'-",
474      \"",
475      \"KEP =",
476      \"RAR ?",
477      \"BAD !",
478      \"",
479      \"PFX I N 1",
480      \"PFX I 0 in .",
481      \"",
482      \"PFX O Y 1",
483      \"PFX O 0 out .",
484      \"",
485      \"SFX S Y 2",
486      \"SFX S 0 s [^s]",
487      \"SFX S 0 es s",
488      \"",
489      \"SFX N N 3",
490      \"SFX N 0 en [^n]",
491      \"SFX N 0 nen n",
492      \"SFX N 0 n .",
493      \"",
494      \"REP 3",
495      \"REP g ch",
496      \"REP ch g",
497      \"REP svp s.v.p.",
498      \"",
499      \"MAP 9",
500      \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
501      \"MAP e\xE8\xE9\xEA\xEB",
502      \"MAP i\xEC\xED\xEE\xEF",
503      \"MAP o\xF2\xF3\xF4\xF5\xF6",
504      \"MAP u\xF9\xFA\xFB\xFC",
505      \"MAP n\xF1",
506      \"MAP c\xE7",
507      \"MAP y\xFF\xFD",
508      \"MAP s\xDF",
509      \ ]
510let g:test_data_dic1 = [
511      \"123456",
512      \"test/NO",
513      \"# comment",
514      \"wrong",
515      \"Comment",
516      \"OK",
517      \"uk",
518      \"put/ISO",
519      \"the end",
520      \"deol",
521      \"d\xE9\xF4r",
522      \ ]
523let g:test_data_aff2 = [
524      \"SET ISO8859-1",
525      \"",
526      \"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",
527      \"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",
528      \"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",
529      \"",
530      \"PFXPOSTPONE",
531      \"",
532      \"MIDWORD\t'-",
533      \"",
534      \"KEP =",
535      \"RAR ?",
536      \"BAD !",
537      \"",
538      \"PFX I N 1",
539      \"PFX I 0 in .",
540      \"",
541      \"PFX O Y 1",
542      \"PFX O 0 out [a-z]",
543      \"",
544      \"SFX S Y 2",
545      \"SFX S 0 s [^s]",
546      \"SFX S 0 es s",
547      \"",
548      \"SFX N N 3",
549      \"SFX N 0 en [^n]",
550      \"SFX N 0 nen n",
551      \"SFX N 0 n .",
552      \"",
553      \"REP 3",
554      \"REP g ch",
555      \"REP ch g",
556      \"REP svp s.v.p.",
557      \"",
558      \"MAP 9",
559      \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
560      \"MAP e\xE8\xE9\xEA\xEB",
561      \"MAP i\xEC\xED\xEE\xEF",
562      \"MAP o\xF2\xF3\xF4\xF5\xF6",
563      \"MAP u\xF9\xFA\xFB\xFC",
564      \"MAP n\xF1",
565      \"MAP c\xE7",
566      \"MAP y\xFF\xFD",
567      \"MAP s\xDF",
568      \ ]
569let g:test_data_aff3 = [
570      \"SET ISO8859-1",
571      \"",
572      \"COMPOUNDMIN 3",
573      \"COMPOUNDRULE m*",
574      \"NEEDCOMPOUND x",
575      \ ]
576let g:test_data_dic3 = [
577      \"1234",
578      \"foo/m",
579      \"bar/mx",
580      \"m\xEF/m",
581      \"la/mx",
582      \ ]
583let g:test_data_aff4 = [
584      \"SET ISO8859-1",
585      \"",
586      \"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",
587      \"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",
588      \"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",
589      \"",
590      \"COMPOUNDRULE m+",
591      \"COMPOUNDRULE sm*e",
592      \"COMPOUNDRULE sm+",
593      \"COMPOUNDMIN 3",
594      \"COMPOUNDWORDMAX 3",
595      \"COMPOUNDFORBIDFLAG t",
596      \"",
597      \"COMPOUNDSYLMAX 5",
598      \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
599      \"",
600      \"MAP 9",
601      \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
602      \"MAP e\xE8\xE9\xEA\xEB",
603      \"MAP i\xEC\xED\xEE\xEF",
604      \"MAP o\xF2\xF3\xF4\xF5\xF6",
605      \"MAP u\xF9\xFA\xFB\xFC",
606      \"MAP n\xF1",
607      \"MAP c\xE7",
608      \"MAP y\xFF\xFD",
609      \"MAP s\xDF",
610      \"",
611      \"NEEDAFFIX x",
612      \"",
613      \"PFXPOSTPONE",
614      \"",
615      \"MIDWORD '-",
616      \"",
617      \"SFX q N 1",
618      \"SFX q   0    -ok .",
619      \"",
620      \"SFX a Y 2",
621      \"SFX a 0 s .",
622      \"SFX a 0 ize/t .",
623      \"",
624      \"PFX p N 1",
625      \"PFX p 0 pre .",
626      \"",
627      \"PFX P N 1",
628      \"PFX P 0 nou .",
629      \ ]
630let g:test_data_dic4 = [
631      \"1234",
632      \"word/mP",
633      \"util/am",
634      \"pro/xq",
635      \"tomato/m",
636      \"bork/mp",
637      \"start/s",
638      \"end/e",
639      \ ]
640let g:test_data_aff5 = [
641      \"SET ISO8859-1",
642      \"",
643      \"FLAG long",
644      \"",
645      \"NEEDAFFIX !!",
646      \"",
647      \"COMPOUNDRULE ssmm*ee",
648      \"",
649      \"NEEDCOMPOUND xx",
650      \"COMPOUNDPERMITFLAG pp",
651      \"",
652      \"SFX 13 Y 1",
653      \"SFX 13 0 bork .",
654      \"",
655      \"SFX a1 Y 1",
656      \"SFX a1 0 a1 .",
657      \"",
658      \"SFX a\xE9 Y 1",
659      \"SFX a\xE9 0 a\xE9 .",
660      \"",
661      \"PFX zz Y 1",
662      \"PFX zz 0 pre/pp .",
663      \"",
664      \"PFX yy Y 1",
665      \"PFX yy 0 nou .",
666      \ ]
667let g:test_data_dic5 = [
668      \"1234",
669      \"foo/a1a\xE9!!",
670      \"bar/zz13ee",
671      \"start/ss",
672      \"end/eeyy",
673      \"middle/mmxx",
674      \ ]
675let g:test_data_aff6 = [
676      \"SET ISO8859-1",
677      \"",
678      \"FLAG caplong",
679      \"",
680      \"NEEDAFFIX A!",
681      \"",
682      \"COMPOUNDRULE sMm*Ee",
683      \"",
684      \"NEEDCOMPOUND Xx",
685      \"",
686      \"COMPOUNDPERMITFLAG p",
687      \"",
688      \"SFX N3 Y 1",
689      \"SFX N3 0 bork .",
690      \"",
691      \"SFX A1 Y 1",
692      \"SFX A1 0 a1 .",
693      \"",
694      \"SFX A\xE9 Y 1",
695      \"SFX A\xE9 0 a\xE9 .",
696      \"",
697      \"PFX Zz Y 1",
698      \"PFX Zz 0 pre/p .",
699      \ ]
700let g:test_data_dic6 = [
701      \"1234",
702      \"mee/A1A\xE9A!",
703      \"bar/ZzN3Ee",
704      \"lead/s",
705      \"end/Ee",
706      \"middle/MmXx",
707      \ ]
708let g:test_data_aff7 = [
709      \"SET ISO8859-1",
710      \"",
711      \"FLAG num",
712      \"",
713      \"NEEDAFFIX 9999",
714      \"",
715      \"COMPOUNDRULE 2,77*123",
716      \"",
717      \"NEEDCOMPOUND 1",
718      \"COMPOUNDPERMITFLAG 432",
719      \"",
720      \"SFX 61003 Y 1",
721      \"SFX 61003 0 meat .",
722      \"",
723      \"SFX 391 Y 1",
724      \"SFX 391 0 a1 .",
725      \"",
726      \"SFX 111 Y 1",
727      \"SFX 111 0 a\xE9 .",
728      \"",
729      \"PFX 17 Y 1",
730      \"PFX 17 0 pre/432 .",
731      \ ]
732let g:test_data_dic7 = [
733      \"1234",
734      \"mee/391,111,9999",
735      \"bar/17,61003,123",
736      \"lead/2",
737      \"tail/123",
738      \"middle/77,1",
739      \ ]
740let g:test_data_aff8 = [
741      \"SET ISO8859-1",
742      \"",
743      \"NOSPLITSUGS",
744      \ ]
745let g:test_data_dic8 = [
746      \"1234",
747      \"foo",
748      \"bar",
749      \"faabar",
750      \ ]
751let g:test_data_aff9 = [
752      \ ]
753let g:test_data_dic9 = [
754      \"1234",
755      \"foo",
756      \"bar",
757      \ ]
758let g:test_data_aff_sal = [
759      \"SET ISO8859-1",
760      \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
761      \"",
762      \"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",
763      \"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",
764      \"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",
765      \"",
766      \"MIDWORD\t'-",
767      \"",
768      \"KEP =",
769      \"RAR ?",
770      \"BAD !",
771      \"",
772      \"PFX I N 1",
773      \"PFX I 0 in .",
774      \"",
775      \"PFX O Y 1",
776      \"PFX O 0 out .",
777      \"",
778      \"SFX S Y 2",
779      \"SFX S 0 s [^s]",
780      \"SFX S 0 es s",
781      \"",
782      \"SFX N N 3",
783      \"SFX N 0 en [^n]",
784      \"SFX N 0 nen n",
785      \"SFX N 0 n .",
786      \"",
787      \"REP 3",
788      \"REP g ch",
789      \"REP ch g",
790      \"REP svp s.v.p.",
791      \"",
792      \"MAP 9",
793      \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
794      \"MAP e\xE8\xE9\xEA\xEB",
795      \"MAP i\xEC\xED\xEE\xEF",
796      \"MAP o\xF2\xF3\xF4\xF5\xF6",
797      \"MAP u\xF9\xFA\xFB\xFC",
798      \"MAP n\xF1",
799      \"MAP c\xE7",
800      \"MAP y\xFF\xFD",
801      \"MAP s\xDF",
802      \"",
803      \"SAL AH(AEIOUY)-^         *H",
804      \"SAL AR(AEIOUY)-^         *R",
805      \"SAL A(HR)^               *",
806      \"SAL A^                   *",
807      \"SAL AH(AEIOUY)-          H",
808      \"SAL AR(AEIOUY)-          R",
809      \"SAL A(HR)                _",
810      \"SAL \xC0^                   *",
811      \"SAL \xC5^                   *",
812      \"SAL BB-                  _",
813      \"SAL B                    B",
814      \"SAL CQ-                  _",
815      \"SAL CIA                  X",
816      \"SAL CH                   X",
817      \"SAL C(EIY)-              S",
818      \"SAL CK                   K",
819      \"SAL COUGH^               KF",
820      \"SAL CC<                  C",
821      \"SAL C                    K",
822      \"SAL DG(EIY)              K",
823      \"SAL DD-                  _",
824      \"SAL D                    T",
825      \"SAL \xC9<                   E",
826      \"SAL EH(AEIOUY)-^         *H",
827      \"SAL ER(AEIOUY)-^         *R",
828      \"SAL E(HR)^               *",
829      \"SAL ENOUGH^$             *NF",
830      \"SAL E^                   *",
831      \"SAL EH(AEIOUY)-          H",
832      \"SAL ER(AEIOUY)-          R",
833      \"SAL E(HR)                _",
834      \"SAL FF-                  _",
835      \"SAL F                    F",
836      \"SAL GN^                  N",
837      \"SAL GN$                  N",
838      \"SAL GNS$                 NS",
839      \"SAL GNED$                N",
840      \"SAL GH(AEIOUY)-          K",
841      \"SAL GH                   _",
842      \"SAL GG9                  K",
843      \"SAL G                    K",
844      \"SAL H                    H",
845      \"SAL IH(AEIOUY)-^         *H",
846      \"SAL IR(AEIOUY)-^         *R",
847      \"SAL I(HR)^               *",
848      \"SAL I^                   *",
849      \"SAL ING6                 N",
850      \"SAL IH(AEIOUY)-          H",
851      \"SAL IR(AEIOUY)-          R",
852      \"SAL I(HR)                _",
853      \"SAL J                    K",
854      \"SAL KN^                  N",
855      \"SAL KK-                  _",
856      \"SAL K                    K",
857      \"SAL LAUGH^               LF",
858      \"SAL LL-                  _",
859      \"SAL L                    L",
860      \"SAL MB$                  M",
861      \"SAL MM                   M",
862      \"SAL M                    M",
863      \"SAL NN-                  _",
864      \"SAL N                    N",
865      \"SAL OH(AEIOUY)-^         *H",
866      \"SAL OR(AEIOUY)-^         *R",
867      \"SAL O(HR)^               *",
868      \"SAL O^                   *",
869      \"SAL OH(AEIOUY)-          H",
870      \"SAL OR(AEIOUY)-          R",
871      \"SAL O(HR)                _",
872      \"SAL PH                   F",
873      \"SAL PN^                  N",
874      \"SAL PP-                  _",
875      \"SAL P                    P",
876      \"SAL Q                    K",
877      \"SAL RH^                  R",
878      \"SAL ROUGH^               RF",
879      \"SAL RR-                  _",
880      \"SAL R                    R",
881      \"SAL SCH(EOU)-            SK",
882      \"SAL SC(IEY)-             S",
883      \"SAL SH                   X",
884      \"SAL SI(AO)-              X",
885      \"SAL SS-                  _",
886      \"SAL S                    S",
887      \"SAL TI(AO)-              X",
888      \"SAL TH                   @",
889      \"SAL TCH--                _",
890      \"SAL TOUGH^               TF",
891      \"SAL TT-                  _",
892      \"SAL T                    T",
893      \"SAL UH(AEIOUY)-^         *H",
894      \"SAL UR(AEIOUY)-^         *R",
895      \"SAL U(HR)^               *",
896      \"SAL U^                   *",
897      \"SAL UH(AEIOUY)-          H",
898      \"SAL UR(AEIOUY)-          R",
899      \"SAL U(HR)                _",
900      \"SAL V^                   W",
901      \"SAL V                    F",
902      \"SAL WR^                  R",
903      \"SAL WH^                  W",
904      \"SAL W(AEIOU)-            W",
905      \"SAL X^                   S",
906      \"SAL X                    KS",
907      \"SAL Y(AEIOU)-            Y",
908      \"SAL ZZ-                  _",
909      \"SAL Z                    S",
910      \ ]
911