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