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