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