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