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