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