391
|
1 Tests for spell checking with 'encoding' set to "utf-8". vim: set ft=vim :
|
|
2
|
|
3 STARTTEST
|
|
4 :so small.vim
|
|
5 :so mbyte.vim
|
|
6 :"
|
414
|
7 :" Don't want to depend on the locale from the environment. The .aff and .dic
|
|
8 :" text is in latin1, the test text is utf-8.
|
|
9 :set enc=latin1
|
|
10 :e!
|
500
|
11 :set enc=utf-8
|
414
|
12 :set fenc=
|
391
|
13 :"
|
500
|
14 :" Function to test .aff/.dic with list of good and bad words.
|
|
15 :func TestOne(aff, dic)
|
|
16 set spellfile=
|
|
17 $put =''
|
|
18 $put ='test '. a:aff . '-' . a:dic
|
|
19 " Generate a .spl file from a .dic and .aff file.
|
|
20 exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff'
|
|
21 exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic'
|
|
22 mkspell! Xtest Xtest
|
|
23 " use that spell file
|
|
24 set spl=Xtest.utf-8.spl spell
|
|
25 " list all valid words
|
|
26 spelldump
|
|
27 %yank
|
|
28 quit
|
|
29 $put
|
|
30 $put ='-------'
|
|
31 " find all bad words and suggestions for them
|
|
32 exe '1;/^' . a:aff . 'good:'
|
|
33 normal 0f:]s
|
|
34 let prevbad = ''
|
|
35 while 1
|
532
|
36 let [bad, a] = spellbadword()
|
500
|
37 if bad == '' || bad == prevbad || bad == 'badend'
|
|
38 break
|
|
39 endif
|
|
40 let prevbad = bad
|
|
41 let lst = spellsuggest(bad, 3)
|
|
42 normal mm
|
|
43 $put =bad
|
|
44 $put =string(lst)
|
|
45 normal `m]s
|
|
46 endwhile
|
391
|
47 endfunc
|
500
|
48 :"
|
|
49 :call TestOne('1', '1')
|
391
|
50 :$put =soundfold('goobledygoook')
|
|
51 :$put =soundfold('kóopërÿnôven')
|
|
52 :$put =soundfold('oeverloos gezwets edale')
|
|
53 :"
|
500
|
54 :"
|
391
|
55 :" and now with SAL instead of SOFO items; test automatic reloading
|
500
|
56 gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff
|
391
|
57 :mkspell! Xtest Xtest
|
|
58 :$put =soundfold('goobledygoook')
|
|
59 :$put =soundfold('kóopërÿnôven')
|
|
60 :$put =soundfold('oeverloos gezwets edale')
|
|
61 :"
|
|
62 :" also use an addition file
|
|
63 gg:/^addstart/+1,/^addend/-1w! Xtest.utf-8.add
|
|
64 :mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add
|
|
65 :set spellfile=Xtest.utf-8.add
|
|
66 /^test2:
|
532
|
67 ]s:let [str, a] = spellbadword()
|
391
|
68 :$put =str
|
418
|
69 :set spl=Xtest_us.utf-8.spl
|
391
|
70 /^test2:
|
532
|
71 ]smm:let [str, a] = spellbadword()
|
391
|
72 :$put =str
|
532
|
73 `m]s:let [str, a] = spellbadword()
|
391
|
74 :$put =str
|
418
|
75 :set spl=Xtest_gb.utf-8.spl
|
391
|
76 /^test2:
|
532
|
77 ]smm:let [str, a] = spellbadword()
|
391
|
78 :$put =str
|
532
|
79 `m]s:let [str, a] = spellbadword()
|
391
|
80 :$put =str
|
418
|
81 :set spl=Xtest_nz.utf-8.spl
|
391
|
82 /^test2:
|
532
|
83 ]smm:let [str, a] = spellbadword()
|
391
|
84 :$put =str
|
532
|
85 `m]s:let [str, a] = spellbadword()
|
391
|
86 :$put =str
|
418
|
87 :set spl=Xtest_ca.utf-8.spl
|
391
|
88 /^test2:
|
532
|
89 ]smm:let [str, a] = spellbadword()
|
391
|
90 :$put =str
|
532
|
91 `m]s:let [str, a] = spellbadword()
|
391
|
92 :$put =str
|
|
93 :"
|
|
94 :" Postponed prefixes
|
500
|
95 :call TestOne('2', '1')
|
|
96 :"
|
|
97 :" Compound words
|
|
98 :call TestOne('3', '3')
|
|
99 :call TestOne('4', '4')
|
501
|
100 :call TestOne('5', '5')
|
|
101 :call TestOne('6', '6')
|
|
102 :call TestOne('7', '7')
|
391
|
103 :"
|
|
104 gg:/^test output:/,$wq! test.out
|
|
105 ENDTEST
|
|
106
|
500
|
107 1affstart
|
391
|
108 SET ISO8859-1
|
|
109 TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
|
|
110
|
|
111 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
112 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
113 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
|
114
|
|
115 SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
|
|
116 SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
|
|
117
|
|
118 MIDWORD '-
|
|
119
|
|
120 KEP =
|
|
121 RAR ?
|
|
122 BAD !
|
|
123
|
|
124 NOSPLITSUGS
|
|
125
|
|
126 PFX I N 1
|
|
127 PFX I 0 in .
|
|
128
|
|
129 PFX O Y 1
|
|
130 PFX O 0 out .
|
|
131
|
|
132 SFX S Y 2
|
|
133 SFX S 0 s [^s]
|
|
134 SFX S 0 es s
|
|
135
|
|
136 SFX N N 3
|
|
137 SFX N 0 en [^n]
|
|
138 SFX N 0 nen n
|
|
139 SFX N 0 n .
|
|
140
|
|
141 REP 3
|
|
142 REP g ch
|
|
143 REP ch g
|
|
144 REP svp s.v.p.
|
|
145
|
|
146 MAP 9
|
|
147 MAP aàáâãäå
|
|
148 MAP eèéêë
|
|
149 MAP iìíîï
|
|
150 MAP oòóôõö
|
|
151 MAP uùúûü
|
|
152 MAP nñ
|
|
153 MAP cç
|
|
154 MAP yÿý
|
|
155 MAP sß
|
500
|
156 1affend
|
391
|
157
|
500
|
158 affstart_sal
|
391
|
159 SET ISO8859-1
|
|
160 TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
|
|
161
|
|
162 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
163 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
164 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
|
165
|
|
166 MIDWORD '-
|
|
167
|
|
168 KEP =
|
|
169 RAR ?
|
|
170 BAD !
|
|
171
|
|
172 NOSPLITSUGS
|
|
173
|
|
174 PFX I N 1
|
|
175 PFX I 0 in .
|
|
176
|
|
177 PFX O Y 1
|
|
178 PFX O 0 out .
|
|
179
|
|
180 SFX S Y 2
|
|
181 SFX S 0 s [^s]
|
|
182 SFX S 0 es s
|
|
183
|
|
184 SFX N N 3
|
|
185 SFX N 0 en [^n]
|
|
186 SFX N 0 nen n
|
|
187 SFX N 0 n .
|
|
188
|
|
189 REP 3
|
|
190 REP g ch
|
|
191 REP ch g
|
|
192 REP svp s.v.p.
|
|
193
|
|
194 MAP 9
|
|
195 MAP aàáâãäå
|
|
196 MAP eèéêë
|
|
197 MAP iìíîï
|
|
198 MAP oòóôõö
|
|
199 MAP uùúûü
|
|
200 MAP nñ
|
|
201 MAP cç
|
|
202 MAP yÿý
|
|
203 MAP sß
|
|
204
|
|
205 SAL AH(AEIOUY)-^ *H
|
|
206 SAL AR(AEIOUY)-^ *R
|
|
207 SAL A(HR)^ *
|
|
208 SAL A^ *
|
|
209 SAL AH(AEIOUY)- H
|
|
210 SAL AR(AEIOUY)- R
|
|
211 SAL A(HR) _
|
|
212 SAL À^ *
|
|
213 SAL Å^ *
|
|
214 SAL BB- _
|
|
215 SAL B B
|
|
216 SAL CQ- _
|
|
217 SAL CIA X
|
|
218 SAL CH X
|
|
219 SAL C(EIY)- S
|
|
220 SAL CK K
|
|
221 SAL COUGH^ KF
|
|
222 SAL CC< C
|
|
223 SAL C K
|
|
224 SAL DG(EIY) K
|
|
225 SAL DD- _
|
|
226 SAL D T
|
|
227 SAL É< E
|
|
228 SAL EH(AEIOUY)-^ *H
|
|
229 SAL ER(AEIOUY)-^ *R
|
|
230 SAL E(HR)^ *
|
|
231 SAL ENOUGH^$ *NF
|
|
232 SAL E^ *
|
|
233 SAL EH(AEIOUY)- H
|
|
234 SAL ER(AEIOUY)- R
|
|
235 SAL E(HR) _
|
|
236 SAL FF- _
|
|
237 SAL F F
|
|
238 SAL GN^ N
|
|
239 SAL GN$ N
|
|
240 SAL GNS$ NS
|
|
241 SAL GNED$ N
|
|
242 SAL GH(AEIOUY)- K
|
|
243 SAL GH _
|
|
244 SAL GG9 K
|
|
245 SAL G K
|
|
246 SAL H H
|
|
247 SAL IH(AEIOUY)-^ *H
|
|
248 SAL IR(AEIOUY)-^ *R
|
|
249 SAL I(HR)^ *
|
|
250 SAL I^ *
|
|
251 SAL ING6 N
|
|
252 SAL IH(AEIOUY)- H
|
|
253 SAL IR(AEIOUY)- R
|
|
254 SAL I(HR) _
|
|
255 SAL J K
|
|
256 SAL KN^ N
|
|
257 SAL KK- _
|
|
258 SAL K K
|
|
259 SAL LAUGH^ LF
|
|
260 SAL LL- _
|
|
261 SAL L L
|
|
262 SAL MB$ M
|
|
263 SAL MM M
|
|
264 SAL M M
|
|
265 SAL NN- _
|
|
266 SAL N N
|
|
267 SAL OH(AEIOUY)-^ *H
|
|
268 SAL OR(AEIOUY)-^ *R
|
|
269 SAL O(HR)^ *
|
|
270 SAL O^ *
|
|
271 SAL OH(AEIOUY)- H
|
|
272 SAL OR(AEIOUY)- R
|
|
273 SAL O(HR) _
|
|
274 SAL PH F
|
|
275 SAL PN^ N
|
|
276 SAL PP- _
|
|
277 SAL P P
|
|
278 SAL Q K
|
|
279 SAL RH^ R
|
|
280 SAL ROUGH^ RF
|
|
281 SAL RR- _
|
|
282 SAL R R
|
|
283 SAL SCH(EOU)- SK
|
|
284 SAL SC(IEY)- S
|
|
285 SAL SH X
|
|
286 SAL SI(AO)- X
|
|
287 SAL SS- _
|
|
288 SAL S S
|
|
289 SAL TI(AO)- X
|
|
290 SAL TH @
|
|
291 SAL TCH-- _
|
|
292 SAL TOUGH^ TF
|
|
293 SAL TT- _
|
|
294 SAL T T
|
|
295 SAL UH(AEIOUY)-^ *H
|
|
296 SAL UR(AEIOUY)-^ *R
|
|
297 SAL U(HR)^ *
|
|
298 SAL U^ *
|
|
299 SAL UH(AEIOUY)- H
|
|
300 SAL UR(AEIOUY)- R
|
|
301 SAL U(HR) _
|
|
302 SAL V^ W
|
|
303 SAL V F
|
|
304 SAL WR^ R
|
|
305 SAL WH^ W
|
|
306 SAL W(AEIOU)- W
|
|
307 SAL X^ S
|
|
308 SAL X KS
|
|
309 SAL Y(AEIOU)- Y
|
|
310 SAL ZZ- _
|
|
311 SAL Z S
|
500
|
312 affend_sal
|
391
|
313
|
500
|
314 2affstart
|
391
|
315 SET ISO8859-1
|
|
316
|
|
317 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
318 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
319 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
|
320
|
|
321 PFXPOSTPONE
|
|
322
|
|
323 MIDWORD '-
|
|
324
|
|
325 KEP =
|
|
326 RAR ?
|
|
327 BAD !
|
|
328
|
|
329 NOSPLITSUGS
|
|
330
|
|
331 PFX I N 1
|
|
332 PFX I 0 in .
|
|
333
|
|
334 PFX O Y 1
|
456
|
335 PFX O 0 out [a-z]
|
391
|
336
|
|
337 SFX S Y 2
|
|
338 SFX S 0 s [^s]
|
|
339 SFX S 0 es s
|
|
340
|
|
341 SFX N N 3
|
|
342 SFX N 0 en [^n]
|
|
343 SFX N 0 nen n
|
|
344 SFX N 0 n .
|
|
345
|
|
346 REP 3
|
|
347 REP g ch
|
|
348 REP ch g
|
|
349 REP svp s.v.p.
|
|
350
|
|
351 MAP 9
|
|
352 MAP aàáâãäå
|
|
353 MAP eèéêë
|
|
354 MAP iìíîï
|
|
355 MAP oòóôõö
|
|
356 MAP uùúûü
|
|
357 MAP nñ
|
|
358 MAP cç
|
|
359 MAP yÿý
|
|
360 MAP sß
|
500
|
361 2affend
|
391
|
362
|
500
|
363 1dicstart
|
391
|
364 123456
|
|
365 test/NO
|
|
366 # comment
|
|
367 wrong
|
|
368 Comment
|
|
369 OK
|
|
370 uk
|
|
371 put/ISO
|
|
372 the end
|
|
373 deol
|
|
374 déôr
|
500
|
375 1dicend
|
391
|
376
|
|
377 addstart
|
|
378 /regions=usgbnz
|
|
379 elequint/2
|
|
380 elekwint/3
|
|
381 addend
|
|
382
|
500
|
383 1good: wrong OK puts. Test the end
|
|
384 bad: inputs comment ok Ok. test déôl end the
|
|
385 badend
|
|
386
|
|
387 2good: puts
|
|
388 bad: inputs comment ok Ok end the. test déôl
|
|
389 badend
|
|
390
|
|
391 Test rules for compounding.
|
|
392
|
|
393 3affstart
|
|
394 SET ISO8859-1
|
|
395
|
|
396 COMPOUNDMIN 3
|
|
397 COMPOUNDFLAGS m*
|
|
398 NEEDCOMPOUND x
|
|
399 3affend
|
|
400
|
|
401 3dicstart
|
|
402 1234
|
|
403 foo/m
|
|
404 bar/mx
|
|
405 mï/m
|
|
406 la/mx
|
|
407 3dicend
|
|
408
|
|
409 3good: foo mï foobar foofoobar barfoo barbarfoo
|
|
410 bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar
|
|
411 badend
|
|
412
|
|
413
|
|
414 Tests for compounding.
|
|
415
|
|
416 4affstart
|
|
417 SET ISO8859-1
|
|
418
|
|
419 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
420 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
421 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
|
422
|
|
423 COMPOUNDFLAGS m+
|
|
424 COMPOUNDFLAGS sm*e
|
|
425 COMPOUNDFLAGS sm+
|
|
426 COMPOUNDMIN 3
|
|
427 COMPOUNDMAX 3
|
|
428
|
|
429 COMPOUNDSYLMAX 5
|
|
430 SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui
|
|
431
|
|
432 MAP 9
|
|
433 MAP aàáâãäå
|
|
434 MAP eèéêë
|
|
435 MAP iìíîï
|
|
436 MAP oòóôõö
|
|
437 MAP uùúûü
|
|
438 MAP nñ
|
|
439 MAP cç
|
|
440 MAP yÿý
|
|
441 MAP sß
|
|
442
|
|
443 NEEDAFFIX x
|
|
444
|
|
445 PFXPOSTPONE
|
|
446
|
|
447 MIDWORD '-
|
|
448
|
|
449 SFX q N 1
|
|
450 SFX q 0 -ok .
|
|
451
|
|
452 SFX a Y 2
|
|
453 SFX a 0 s .
|
|
454 SFX a 0 ize . nocomp
|
|
455
|
|
456 PFX p N 1
|
|
457 PFX p 0 pre .
|
|
458 4affend
|
|
459
|
|
460 4dicstart
|
|
461 1234
|
|
462 word/m
|
|
463 util/am
|
|
464 pro/xq
|
|
465 tomato/m
|
|
466 bork/mp
|
|
467 start/s
|
|
468 end/e
|
|
469 4dicend
|
|
470
|
|
471 4good: word util bork prebork start end wordutil wordutils pro-ok
|
|
472 bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
|
|
473 tomato tomatotomato startend startword startwordword startwordend
|
|
474 startwordwordend startwordwordwordend prebork preborkprebork
|
|
475 preborkborkprebork preborkpreborkbork
|
|
476 bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato
|
|
477 endstart endend startstart wordend wordstart
|
|
478 startwordwordwordwordend borkpreborkpreborkbork
|
|
479 badend
|
391
|
480
|
|
481 test2:
|
|
482 elequint test elekwint test elekwent asdf
|
|
483
|
501
|
484 Test affix flags with two characters
|
|
485
|
|
486 5affstart
|
|
487 SET ISO8859-1
|
|
488
|
|
489 FLAG long
|
|
490
|
|
491 NEEDAFFIX !!
|
|
492
|
|
493 COMPOUNDFLAGS ssmm*ee
|
|
494
|
|
495 NEEDCOMPOUND xx
|
|
496
|
|
497 SFX 13 Y 1
|
|
498 SFX 13 0 bork .
|
|
499
|
|
500 SFX a1 Y 1
|
|
501 SFX a1 0 a1 .
|
|
502
|
|
503 SFX aé Y 1
|
|
504 SFX aé 0 aé .
|
|
505
|
|
506 PFX zz Y 1
|
|
507 PFX zz 0 pre .
|
|
508 5affend
|
|
509
|
|
510 5dicstart
|
|
511 1234
|
|
512 foo/a1aé!!
|
|
513 bar/zz13ee
|
|
514 start/ss
|
|
515 end/ee
|
|
516 middle/mmxx
|
|
517 5dicend
|
|
518
|
|
519 5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
|
|
520 start end startend startmiddleend
|
|
521 bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
|
|
522 startprobar
|
|
523 badend
|
|
524
|
|
525 6affstart
|
|
526 SET ISO8859-1
|
|
527
|
|
528 FLAG caplong
|
|
529
|
|
530 NEEDAFFIX A!
|
|
531
|
|
532 COMPOUNDFLAGS sMm*Ee
|
|
533
|
|
534 NEEDCOMPOUND Xx
|
|
535
|
|
536 SFX N3 Y 1
|
|
537 SFX N3 0 bork .
|
|
538
|
|
539 SFX A1 Y 1
|
|
540 SFX A1 0 a1 .
|
|
541
|
|
542 SFX Aé Y 1
|
|
543 SFX Aé 0 aé .
|
|
544
|
|
545 PFX Zz Y 1
|
|
546 PFX Zz 0 pre .
|
|
547 6affend
|
|
548
|
|
549 6dicstart
|
|
550 1234
|
|
551 mee/A1AéA!
|
|
552 bar/ZzN3Ee
|
|
553 lead/s
|
|
554 end/Ee
|
|
555 middle/MmXx
|
|
556 6dicend
|
|
557
|
|
558 6good: meea1 meeaé bar prebar barbork prebarbork leadprebar
|
|
559 lead end leadend leadmiddleend
|
|
560 bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead
|
|
561 leadprobar
|
|
562 badend
|
|
563
|
|
564 7affstart
|
|
565 SET ISO8859-1
|
|
566
|
|
567 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
568 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
|
569 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
|
570
|
|
571 FLAG num
|
|
572
|
|
573 NEEDAFFIX 9999
|
|
574
|
|
575 COMPOUNDFLAGS 2,77*123
|
|
576
|
|
577 NEEDCOMPOUND 1
|
|
578
|
|
579 SFX 61003 Y 1
|
|
580 SFX 61003 0 meat .
|
|
581
|
|
582 SFX 391 Y 1
|
|
583 SFX 391 0 a1 .
|
|
584
|
|
585 SFX 111 Y 1
|
|
586 SFX 111 0 aé .
|
|
587
|
|
588 PFX 17 Y 1
|
|
589 PFX 17 0 pre .
|
|
590 7affend
|
|
591
|
|
592 7dicstart
|
|
593 1234
|
|
594 mee/391,111,9999
|
|
595 bar/17,61003,123
|
|
596 lead/2
|
|
597 tail/123
|
|
598 middle/77,1
|
|
599 7dicend
|
|
600
|
|
601 7good: meea1 meeaé bar prebar barmeat prebarmeat leadprebar
|
|
602 lead tail leadtail leadmiddletail
|
|
603 bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead
|
|
604 leadprobar
|
|
605 badend
|
|
606
|
391
|
607 test output:
|