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