1 Tests for spell checking. vim: set ft=vim :
6 :" Don't want to depend on the locale from the environment
10 :" Function to test .aff/.dic with list of good and bad words.
11 :func TestOne(aff, dic)
14 $put ='test '. a:aff . '-' . a:dic
15 " Generate a .spl file from a .dic and .aff file.
16 exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff'
17 exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic'
20 set spl=Xtest.latin1.spl spell
21 " list all valid words
27 " find all bad words and suggestions for them
28 exe '1;/^' . a:aff . 'good:'
32 let [bad, a] = spellbadword()
33 if bad == '' || bad == prevbad || bad == 'badend'
37 let lst = spellsuggest(bad, 3)
45 :call TestOne('1', '1')
46 :$put =soundfold('goobledygoook')
47 :$put =soundfold('kóopërÿnôven')
48 :$put =soundfold('oeverloos gezwets edale')
51 :" and now with SAL instead of SOFO items; test automatic reloading
52 gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff
54 :$put =soundfold('goobledygoook')
55 :$put =soundfold('kóopërÿnôven')
56 :$put =soundfold('oeverloos gezwets edale')
58 :" also use an addition file
59 gg:/^addstart/+1,/^addend/-1w! Xtest.latin1.add
60 :mkspell! Xtest.latin1.add.spl Xtest.latin1.add
61 :set spellfile=Xtest.latin1.add
63 ]s:let [str, a] = spellbadword()
65 :set spl=Xtest_us.latin1.spl
67 ]smm:let [str, a] = spellbadword()
69 `m]s:let [str, a] = spellbadword()
71 :set spl=Xtest_gb.latin1.spl
73 ]smm:let [str, a] = spellbadword()
75 `m]s:let [str, a] = spellbadword()
77 :set spl=Xtest_nz.latin1.spl
79 ]smm:let [str, a] = spellbadword()
81 `m]s:let [str, a] = spellbadword()
83 :set spl=Xtest_ca.latin1.spl
85 ]smm:let [str, a] = spellbadword()
87 `m]s:let [str, a] = spellbadword()
92 :call TestOne('2', '1')
95 :call TestOne('3', '3')
96 :call TestOne('4', '4')
97 :call TestOne('5', '5')
98 :call TestOne('6', '6')
99 :call TestOne('7', '7')
102 :call TestOne('8', '8')
104 :" clean up for valgrind
108 gg:/^test output:/,$wq! test.out
113 TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
115 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
116 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
117 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
119 SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
120 SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
160 1good: wrong OK puts. Test the end
161 bad: inputs comment ok Ok. test déôl end the
180 TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
182 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
183 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
184 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
335 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
336 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
337 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
380 bad: inputs comment ok Ok end the. test déôl
390 elequint test elekwint test elekwent asdf
392 Test rules for compounding.
410 3good: foo mï foobar foofoobar barfoo barbarfoo
411 bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar
415 Tests for compounding.
420 FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
421 LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
422 UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
432 SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui
476 4good: word util bork prebork start end wordutil wordutils pro-ok
477 bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
478 tomato tomatotomato startend startword startwordword startwordend
479 startwordwordend startwordwordwordend prebork preborkbork
482 bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato
483 endstart endend startstart wordend wordstart
484 preborkprebork preborkpreborkbork
485 startwordwordwordwordend borkpreborkpreborkbork
486 utilsbork startnouword
489 Test affix flags with two characters
501 COMPOUNDPERMITFLAG pp
528 5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
529 start end startend startmiddleend nouend
530 bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
531 startprobar startnouend
569 6good: meea1 meeaé bar prebar barbork prebarbork leadprebar
570 lead end leadend leadmiddleend
571 bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead
582 COMPOUNDRULE 2,77*123
585 COMPOUNDPERMITFLAG 432
609 7good: meea1 meeaé bar prebar barmeat prebarmeat leadprebar
610 lead tail leadtail leadmiddletail
611 bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead
630 8good: foo bar faabar